SHIMADA Koji
null+****@clear*****
Wed Oct 3 23:55:53 JST 2012
SHIMADA Koji 2012-10-03 23:55:53 +0900 (Wed, 03 Oct 2012) New Revision: 9a971c3c774714fa18683c62e832c6d67d88692b https://github.com/logaling/logaling-server/commit/9a971c3c774714fa18683c62e832c6d67d88692b Log: Toggle star/star-empty Modified files: app/decorators/user_config_decorator.rb app/views/dashboard/show.html.haml Modified: app/decorators/user_config_decorator.rb (+5 -1) =================================================================== --- app/decorators/user_config_decorator.rb 2012-10-03 23:23:01 +0900 (3a2a1da) +++ app/decorators/user_config_decorator.rb 2012-10-03 23:55:53 +0900 (f8cc1f3) @@ -1,7 +1,11 @@ # coding: utf-8 module UserConfigDecorator def mark_for(glossary) - same?(glossary) ? "★" : "☆" + if same?(glossary) + content_tag(:i, '', class: 'icon-star') + else + content_tag(:i, '', class: 'icon-star-empty') + end end def submit_path_for(user) Modified: app/views/dashboard/show.html.haml (+7 -6) =================================================================== --- app/views/dashboard/show.html.haml 2012-10-03 23:23:01 +0900 (d1f80dd) +++ app/views/dashboard/show.html.haml 2012-10-03 23:55:53 +0900 (ccda1c4) @@ -14,7 +14,7 @@ = link_to user_glossary.link_text, user_glossary_path(current_user, user_glossary) %span.btn-group.actions %label{ :for => "commit_#{user_glossary.id}", :class => "btn btn-mini" } - %i{ :class => 'icon-star' } + = @user_config.mark_for(user_glossary) = form_for @user_config, url: @user_config.submit_path_for(current_user), :html => {:style => "margin:0;"} do |f| = f.hidden_field :glossary_name, value: user_glossary.glossary_name = f.hidden_field :source_language, value: user_glossary.source_language @@ -30,21 +30,22 @@ %h3 プロジェクト一覧 %ul.projectsList - - @github_projects.each do |github_project| + - @github_projects.each_with_index do |github_project, i| %li = github_project.full_name %span.btn-group.actions = link_to raw("<i class=icon-trash></i>"), user_github_project_membership_path(current_user, github_project.memberships.of(current_user).first), method: :delete, :class => 'btn btn-mini' %ul.glossariesList - - github_project.glossaries.each_with_index do |glossary, i| + - github_project.glossaries.each_with_index do |glossary, j| %li - bilingual_pair = [glossary.source_language, glossary.target_language].join('-') = link_to "#{glossary.source_language} #{glossary.target_language}", github_project_glossary_path(:id => bilingual_pair, :github_project_id => github_project) %span.btn-group.actions - %label{ :for => "commit_github_project_glossary_#{i}", :class => "btn btn-mini" } - %i{ :class => 'icon-star' } + %label{ :for => "commit_github_project_glossary_#{i}#{j}", :class => "btn btn-mini" } + = @user_config.mark_for(glossary) = form_for @user_config, url: @user_config.submit_path_for(current_user), :html => { :style => "margin:0;" } do |f| = f.hidden_field :glossary_name, value: glossary.name = f.hidden_field :source_language, value: glossary.source_language = f.hidden_field :target_language, value: glossary.target_language - = f.submit '', :class => 'hidden', :id => "commit_github_project_glossary_#{i}" + = f.submit '', :class => 'hidden', :id => "commit_github_project_glossary_#{i}#{j}" + -------------- next part -------------- An HTML attachment was scrubbed... Download