From 8f6d9fc6a58a077eb333bea7a37f8a00628813c6 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Fri, 18 Apr 2014 10:46:29 +0800 Subject: [PATCH] 0418 --- Gemfile | 1 + Gemfile.lock | 4 ++++ app/helpers/application_helper.rb | 4 ++++ app/models/softapplication.rb | 2 ++ app/views/layouts/base_newcontest.html.erb | 5 +++-- app/views/softapplications/show.html.erb | 4 ++++ config/application.rb | 1 + public/javascripts/application.js | 1 + 8 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index dd19b443..dc4db9c8 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,6 @@ source 'https://rubygems.org' +gem "seems_rateable" gem "rails", "3.2.13" gem "jquery-rails", "~> 2.0.2" gem "i18n", "~> 0.6.0" diff --git a/Gemfile.lock b/Gemfile.lock index d60847b1..42cb6227 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -79,6 +79,9 @@ GEM rdoc (3.12.2) json (~> 1.4) ruby-openid (2.1.8) + seems_rateable (1.0.13) + jquery-rails + rails sprockets (2.2.2) hike (~> 1.2) multi_json (~> 1.0) @@ -109,3 +112,4 @@ DEPENDENCIES rails (= 3.2.13) rdoc (>= 2.4.2) ruby-openid (~> 2.1.4) + seems_rateable diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9b3a672c..dd900bf3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1601,5 +1601,9 @@ module ApplicationHelper end content_tag :ul, content_li.html_safe end + + def current_user + User.current + end end diff --git a/app/models/softapplication.rb b/app/models/softapplication.rb index fa90881b..603279fb 100644 --- a/app/models/softapplication.rb +++ b/app/models/softapplication.rb @@ -1,6 +1,8 @@ class Softapplication < ActiveRecord::Base attr_accessible :android_min_version_available, :app_type_id, :app_type_name, :description, :name, :user_id, :contest_id, :application_developers acts_as_attachable + seems_rateable :allow_update => true, :dimensions => :quality + seems_rateable_rater has_many :journals_for_messages, :as => :jour, :dependent => :destroy has_many :contesting_softapplications, :dependent => :destroy belongs_to :user diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index f8c7056b..c0e23bf2 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -8,8 +8,9 @@ <%= csrf_meta_tag %> <%= favicon %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> + <%= seems_rateable_stylesheet %> <%= javascript_heads %> <%= heads_for_theme %> <%= call_hook :view_layouts_base_html_head %> @@ -148,7 +149,7 @@
- +
+ + + +
<%= render :partial => 'tags/tag', :locals => {:obj => @contest, :object_flag => "7"}%> diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index 0e2ee738..fcd74677 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -34,6 +34,10 @@ 开发人员:<%= @softapplication.application_developers %>
rate: <%=rating_for @softapplication, :dimension => :qulity %>
diff --git a/config/application.rb b/config/application.rb index 593eed64..d37a9eae 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,6 +1,7 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' +require 'sprockets/railtie' if defined?(Bundler) # If you precompile assets before deploying to production, use this line diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 2845c3ce..3067b0f2 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -1,3 +1,4 @@ +//= require_directory ./rateable /* Redmine - project management software Copyright (C) 2006-2013 Jean-Philippe Lang */