diff --git a/app/controllers/praise_tread_controller.rb b/app/controllers/praise_tread_controller.rb index 48574bca..0fdb1b2c 100644 --- a/app/controllers/praise_tread_controller.rb +++ b/app/controllers/praise_tread_controller.rb @@ -10,7 +10,6 @@ class PraiseTreadController < ApplicationController @obj_id = params[:obj_id] @obj_type = params[:obj_type] @obj = find_object_by_type_and_id(@obj_type,@obj_id) - # @is_in_list = params[:is_in_list] praise_tread_plus(@obj_type,@obj_id,1) end end @@ -46,7 +45,6 @@ class PraiseTreadController < ApplicationController @obj_id = params[:obj_id] @obj_type = params[:obj_type] @obj = find_object_by_type_and_id(@obj_type,@obj_id) - # @is_in_list = params[:is_in_list] praise_tread_plus(@obj_type,@obj_id,0) end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 20494dad..e33104f9 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -31,7 +31,7 @@ class UsersController < ApplicationController accept_api_auth :index, :show, :create, :update, :destroy,:tag_save #william - before_filter :need_login,:only => :tag_save + before_filter :require_login,:only => :tag_save helper :sort diff --git a/app/helpers/praise_tread_helper.rb b/app/helpers/praise_tread_helper.rb index 26e4e5f4..90ce6d61 100644 --- a/app/helpers/praise_tread_helper.rb +++ b/app/helpers/praise_tread_helper.rb @@ -9,17 +9,18 @@ module PraiseTreadHelper end #end - def get_praise_num(object,flag) + def get_praise_num(object) @obj_type = object.class @obj_id = object.id @record = PraiseTreadCache.find_by_object_id_and_object_type(@obj_id,@obj_type) if @record - case flag - when 1 - return @record.praise_num.nil? ? 0 : @record.praise_num - when 0 - return @record.tread_num.nil? ? 0 : @record.tread_num - end + # case flag + # when 1 + # return @record.praise_num.nil? ? 0 : @record.praise_num + # when 0 + # return @record.tread_num.nil? ? 0 : @record.tread_num + # end + return (@record.praise_num.to_i-@record.tread_num.to_i) else return 0 end diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index 2917bdf4..e03587c5 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -2,6 +2,8 @@

<%= issue_heading(@issue) %>

+> +
<% if @prev_issue_id || @next_issue_id %> diff --git a/app/views/praise_tread/_praise_tread.html.erb b/app/views/praise_tread/_praise_tread.html.erb index 4ed2328c..5c90b972 100644 --- a/app/views/praise_tread/_praise_tread.html.erb +++ b/app/views/praise_tread/_praise_tread.html.erb @@ -1,4 +1,5 @@ + <% if User.current.logged? %>
<% @is_valuate = is_praise_or_tread(obj,user_id)%> @@ -10,7 +11,7 @@ <%= image_tag("/images/praise_tread/praise_true.png") %> - +<%= get_praise_num(obj,1)%> + <%= get_praise_num(obj)%> @@ -24,7 +25,7 @@ - -<%= get_praise_num(obj,0)%> + <%= get_praise_num(obj)%> <%= image_tag("/images/praise_tread/tread_true.png") %> @@ -40,11 +41,7 @@ :controller=>"praise_tread",:action=>"praise_plus",:remote=>true,:obj_id => obj.id,:obj_type => obj.class%> - +<%= get_praise_num(obj,1)%> - - --- - - -<%= get_praise_num(obj,0)%> + <%= get_praise_num(obj)%> <%= link_to image_tag("/images/praise_tread/tread_false.png"),:controller=>"praise_tread", @@ -55,3 +52,4 @@ <% end %>
+<% end %> diff --git a/app/views/praise_tread/tread_plus.js.erb b/app/views/praise_tread/tread_plus.js.erb new file mode 100644 index 00000000..89efec2d --- /dev/null +++ b/app/views/praise_tread/tread_plus.js.erb @@ -0,0 +1,5 @@ + +$('#praise_tread_<%= @obj.id %>').html('<%= j( +render :partial => "/praise_tread/praise_tread",:locals => {:obj => @obj,:user_id => User.current.id} +)%>'); + diff --git a/app/views/projects/_project.html.erb b/app/views/projects/_project.html.erb index 33a27076..a89c79e5 100644 --- a/app/views/projects/_project.html.erb +++ b/app/views/projects/_project.html.erb @@ -44,7 +44,7 @@
<%= tag('img', {:src => "/images/sidebar/tags.png"}, false, false) %> - <%= render :partial => 'layouts/tag_name', :locals => {:obj => @project,:object_flag => "2",:non_list_all => true }%> + <%= render :partial => 'tags/tag_name', :locals => {:obj => @project,:object_flag => "2",:non_list_all => true }%>
diff --git a/app/views/tags/_tag.html.erb b/app/views/tags/_tag.html.erb new file mode 100644 index 00000000..3b3768fb --- /dev/null +++ b/app/views/tags/_tag.html.erb @@ -0,0 +1,47 @@ +
+ <% if User.current.logged? %> + <%= tag('img', {:src => "/images/sidebar/tags.png"}, false, false) %> + <% end %> + + + + <% if object_flag == '3' %> + <% if User.current.logged? %> + <%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form-issue', {:focus => 'name-issue'} %> + <% end %> +
+ <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
+ +
+ +<% else %> +<% if User.current.logged? %> +<%= toggle_link (image_tag "/images/sidebar/add.png"), 'put-tag-form', {:focus => 'name'} %> +<% end %> +
+ <%= render :partial => "tags/tag_name",:locals => {:obj => obj,:non_list_all => false ,:object_flag => object_flag} %> +
+ + +<% end %> diff --git a/app/views/tags/_tag_name.html.erb b/app/views/tags/_tag_name.html.erb new file mode 100644 index 00000000..ceffa0ad --- /dev/null +++ b/app/views/tags/_tag_name.html.erb @@ -0,0 +1,61 @@ + + +<% @tags = obj.reload.tag_list %> + +<% if non_list_all and (@tags.size > 0) %> + +<% if @tags.size > Setting.show_tags_length.to_i then %> +<% i = 0 %> +<% until i>Setting.show_tags_length.to_i do %> +
+ <%= link_to @tags[i], :controller => "tags",:action => "index",:q => @tags[i],:object_flag => object_flag,:obj_id => obj.id %> +
+<% i += 1%> +<% end %> +<%= link_to l(:label_more_tags),:action => "show",:id => obj.id %> + +<% else %> + +<% @tags.each do |tag| %> +
+ <%= link_to tag,:controller => "tags",:action => "index",:q=>tag,:object_flag => object_flag,:obj_id => obj.id +%> +
+<% end %> +<% end %> + +<% else %> + +<% if @tags.size > 0 %> +<% @tags.each do |tag| %> +
+ <%= link_to tag,:controller => "tags",:action => "index",:q=>tag ,:object_flag => object_flag,:obj_id => obj.id %> +
+<% end %> +<% end %> + +<% end %> \ No newline at end of file diff --git a/app/views/users/show_old.html.erb b/app/views/users/show_old.html.erb index c5eed8d8..9ce6c160 100644 --- a/app/views/users/show_old.html.erb +++ b/app/views/users/show_old.html.erb @@ -149,7 +149,7 @@
- <%= render :partial => 'layouts/tag', :locals => {:obj => @user,:object_flag => "1"}%> + <%= render :partial => 'tags/tag', :locals => {:obj => @user,:object_flag => "1"}%>
diff --git a/app/views/users/tag_save.js.erb b/app/views/users/tag_save.js.erb index a5a07b0b..6b13f6b4 100644 --- a/app/views/users/tag_save.js.erb +++ b/app/views/users/tag_save.js.erb @@ -1,12 +1,12 @@ <% if @obj_flag == '3'%> -$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'layouts/tag_name', +$('#tags_show_issue').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); $('#put-tag-form-issue').hide(); $('#name-issue').val(""); <% else %> -$('#tags_show').html('<%= escape_javascript(render :partial => 'layouts/tag_name', +$('#tags_show').html('<%= escape_javascript(render :partial => 'tags/tag_name', :locals => {:obj => @obj,:non_list_all => false,:object_flag => @obj_flag}) %>'); $('#put-tag-form').hide(); $('#name').val(""); diff --git a/public/images/issue_tag.png b/public/images/issue_tag.png new file mode 100644 index 00000000..eacaf7a5 Binary files /dev/null and b/public/images/issue_tag.png differ