├── .github └── FUNDING.yml ├── app ├── helpers │ └── like_helper.rb ├── models │ ├── like.rb │ ├── like_mailer.rb │ └── like_constants.rb ├── views │ ├── like_mailer │ │ ├── on_like.text.erb │ │ └── on_like.html.erb │ ├── issues │ │ ├── _issuesShowDetailsBottom.html.erb │ │ └── _issuesHistoryJournalBottom.html.erb │ ├── wiki │ │ └── _layoutsBaseContent.html.erb │ └── like │ │ ├── _likeIcon.html.erb │ │ └── index.html.erb └── controllers │ └── like_controller.rb ├── assets ├── images │ ├── like_total.png │ ├── icon_heart_on.png │ ├── icon_star_off.png │ ├── icon_star_on.png │ ├── issue_page_ss.png │ ├── summary_page.png │ ├── type_of_icons.png │ ├── wiki_page_ss.png │ ├── icon_heart_off.png │ ├── like_tooltip_ss.png │ ├── icon_thumbsup_off.png │ ├── icon_thumbsup_on.png │ ├── icon_heart_shadow_on.png │ ├── icon_star_shadow_off.png │ ├── icon_star_shadow_on.png │ ├── icon_heart_shadow_off.png │ ├── icon_thumbsup_shadow_on.png │ └── icon_thumbsup_shadow_off.png ├── stylesheets │ └── like.css └── javascripts │ └── like.js ├── test ├── test_helper.rb ├── unit │ ├── like_test.rb │ └── like_mailer_test.rb └── functional │ └── like_controller_test.rb ├── db └── migrate │ ├── 202204292130_add_author_id_to_likes.rb │ └── 001_create_likes.rb ├── config ├── routes.rb └── locales │ ├── ja.yml │ └── en.yml ├── init.rb ├── LICENSE ├── README.md └── lib └── like └── hooks.rb /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | liberapay: happy-se-life 2 | -------------------------------------------------------------------------------- /app/helpers/like_helper.rb: -------------------------------------------------------------------------------- 1 | module LikeHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/models/like.rb: -------------------------------------------------------------------------------- 1 | class Like < ActiveRecord::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/views/like_mailer/on_like.text.erb: -------------------------------------------------------------------------------- 1 | <%= @title %> 2 | <%= @content %> 3 | -------------------------------------------------------------------------------- /app/views/like_mailer/on_like.html.erb: -------------------------------------------------------------------------------- 1 |
<%= @title %>
2 |<%= @content %>
3 | -------------------------------------------------------------------------------- /assets/images/like_total.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/like_total.png -------------------------------------------------------------------------------- /assets/images/icon_heart_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_heart_on.png -------------------------------------------------------------------------------- /assets/images/icon_star_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_star_off.png -------------------------------------------------------------------------------- /assets/images/icon_star_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_star_on.png -------------------------------------------------------------------------------- /assets/images/issue_page_ss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/issue_page_ss.png -------------------------------------------------------------------------------- /assets/images/summary_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/summary_page.png -------------------------------------------------------------------------------- /assets/images/type_of_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/type_of_icons.png -------------------------------------------------------------------------------- /assets/images/wiki_page_ss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/wiki_page_ss.png -------------------------------------------------------------------------------- /assets/images/icon_heart_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_heart_off.png -------------------------------------------------------------------------------- /assets/images/like_tooltip_ss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/like_tooltip_ss.png -------------------------------------------------------------------------------- /assets/images/icon_thumbsup_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_thumbsup_off.png -------------------------------------------------------------------------------- /assets/images/icon_thumbsup_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_thumbsup_on.png -------------------------------------------------------------------------------- /assets/images/icon_heart_shadow_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_heart_shadow_on.png -------------------------------------------------------------------------------- /assets/images/icon_star_shadow_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_star_shadow_off.png -------------------------------------------------------------------------------- /assets/images/icon_star_shadow_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_star_shadow_on.png -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | # Load the Redmine helper 2 | require File.expand_path(File.dirname(__FILE__) + '/../../../test/test_helper') 3 | -------------------------------------------------------------------------------- /assets/images/icon_heart_shadow_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_heart_shadow_off.png -------------------------------------------------------------------------------- /assets/images/icon_thumbsup_shadow_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_thumbsup_shadow_on.png -------------------------------------------------------------------------------- /assets/images/icon_thumbsup_shadow_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/happy-se-life/like/master/assets/images/icon_thumbsup_shadow_off.png -------------------------------------------------------------------------------- /app/views/issues/_issuesShowDetailsBottom.html.erb: -------------------------------------------------------------------------------- 1 | <%= render :partial => "like/likeIcon", :locals => { id: id, count: count, type: type, design: design, like_senders: like_senders} %> -------------------------------------------------------------------------------- /app/views/issues/_issuesHistoryJournalBottom.html.erb: -------------------------------------------------------------------------------- 1 | <%= render :partial => "like/likeIcon", :locals => { id: id, count: count, type: type, design: design, like_senders: like_senders} %> -------------------------------------------------------------------------------- /app/models/like_mailer.rb: -------------------------------------------------------------------------------- 1 | class LikeMailer < Mailer 2 | def on_like(user_to, title, content) 3 | @title = title 4 | @content = content 5 | mail to: user_to.mail, subject: @title 6 | end 7 | end -------------------------------------------------------------------------------- /test/unit/like_test.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../test_helper', __FILE__) 2 | 3 | class LikeTest < ActiveSupport::TestCase 4 | 5 | # Replace this with your real tests. 6 | def test_truth 7 | assert true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/unit/like_mailer_test.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../test_helper', __FILE__) 2 | 3 | class LikeMailerTest < ActiveSupport::TestCase 4 | 5 | # Replace this with your real tests. 6 | def test_truth 7 | assert true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /test/functional/like_controller_test.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../../test_helper', __FILE__) 2 | 3 | class LikeControllerTest < ActionController::TestCase 4 | # Replace this with your real tests. 5 | def test_truth 6 | assert true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/202204292130_add_author_id_to_likes.rb: -------------------------------------------------------------------------------- 1 | class AddAuthorIdToLikes < ActiveRecord::Migration[4.2] 2 | def up 3 | add_column :likes, :author_id, :integer, :default => nil, :after => :like_id 4 | end 5 | 6 | def down 7 | remove_column :author_id 8 | end 9 | end -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | # Plugin's routes 2 | # See: http://guides.rubyonrails.org/routing.html 3 | Rails.application.routes.draw do 4 | resources :like 5 | post 'issues/update_like', to: 'like#update_like' 6 | post 'projects/:id/update_like', to: 'like#update_like' 7 | post 'projects/:id/wiki/update_like', to: 'like#update_like' 8 | end -------------------------------------------------------------------------------- /app/views/wiki/_layoutsBaseContent.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <%= javascript_include_tag "like", :plugin => "like" %> 3 | 4 | <%= stylesheet_link_tag "like", :plugin => "like" %> 5 | <% if is_wiki == true %> 6 | <%= render :partial => "like/likeIcon", :locals => { id: id, count: count, type: type, design: design, like_senders: like_senders} %> 7 | <% end %> -------------------------------------------------------------------------------- /db/migrate/001_create_likes.rb: -------------------------------------------------------------------------------- 1 | class CreateLikes < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :likes do |t| 4 | t.integer :user_id, :null => false 5 | t.integer :like_id, :null => false 6 | t.string :like_type, :null => false 7 | t.timestamps :null => false 8 | end 9 | add_index :likes, [:like_id, :like_type] 10 | add_index :likes, :user_id 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /config/locales/ja.yml: -------------------------------------------------------------------------------- 1 | # Japanese strings go here for Rails i18n 2 | ja: 3 | like_label_like: "いいね!" 4 | like_field_user: "名前" 5 | like_field_count_for_issue: "チケット" 6 | like_field_count_for_journal: "注記" 7 | like_field_count_for_wiki: "Wiki" 8 | like_field_count_total: "計" 9 | like_mail_title: "%{name}さんがあなたの%{kind}にいいね!しました" 10 | like_label_received_count: "受け取ったいいねの数" 11 | like_label_sent_count: "送ったいいねの数" 12 | -------------------------------------------------------------------------------- /app/models/like_constants.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Constant definition 3 | # 4 | class LikeConstants 5 | # 6 | # Choose an icon design 7 | # "icon_heart" 8 | # "icon_heart_shadow" 9 | # "icon_star" 10 | # "icon_star_shadow" 11 | # "icon_thumbsup" 12 | # "icon_thumbsup_shadow" 13 | # 14 | ICON_DESIGN = "icon_heart" 15 | # 16 | # Enable mail notification (1:on 0:off) 17 | ENABLE_MAIL_NOTIFICATION = 0 18 | end 19 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # English strings go here for Rails i18n 2 | en: 3 | like_label_like: "LIKE!" 4 | like_field_user: "Name" 5 | like_field_count_for_issue: "Ticket" 6 | like_field_count_for_journal: "Notes" 7 | like_field_count_for_wiki: "Wiki" 8 | like_field_count_total: "Total" 9 | like_mail_title: "%{name} liked your %{kind}" 10 | like_label_received_count: "Number of likes received" 11 | like_label_sent_count: "The number of likes sent" 12 | -------------------------------------------------------------------------------- /init.rb: -------------------------------------------------------------------------------- 1 | Redmine::Plugin.register :like do 2 | name 'Like plugin' 3 | author 'Kohei Nomura' 4 | description 'This plug-in allows you to send the likes.' 5 | version '0.0.3' 6 | url 'https://github.com/happy-se-life/like' 7 | author_url 'mailto:kohei_nom@yahoo.co.jp' 8 | require_dependency File.expand_path('../lib/like/hooks', __FILE__) 9 | menu :application_menu, :like, { :controller => 'like', :action => 'index' }, :caption => :like_label_like, :if => Proc.new { User.current.logged? } 10 | end -------------------------------------------------------------------------------- /assets/stylesheets/like.css: -------------------------------------------------------------------------------- 1 | .like-icon-outer { 2 | width: 40px; 3 | margin-left: auto; 4 | text-align: right; 5 | cursor: pointer; 6 | } 7 | 8 | .like-side-by-side p{ 9 | display: inline-block; 10 | vertical-align: middle; 11 | } 12 | 13 | .like-sender-tooltip { 14 | position: relative; 15 | cursor: pointer; 16 | } 17 | .like-sender-tooltip p{ 18 | margin:0; 19 | padding:0; 20 | } 21 | .like-sender-content { 22 | display: none; 23 | position: absolute; 24 | padding: 10px; 25 | font-size: x-small; 26 | text-align: left; 27 | color: #fff; 28 | border-radius: 5px; 29 | background: #000; 30 | width: 100px; 31 | } 32 | .like-sender-content:before { 33 | content: ""; 34 | position: absolute; 35 | top: 0px; 36 | left: 120px; 37 | border: 15px solid transparent; 38 | border-top: 15px solid #000; 39 | margin-left: -5px; 40 | transform: rotateZ(270deg); 41 | } 42 | .like-sender-tooltip:hover .like-sender-content{ 43 | display: inline-block; 44 | top: -10px; 45 | left: -120px; 46 | } 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 happy-se-life 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/views/like/_likeIcon.html.erb: -------------------------------------------------------------------------------- 1 | 2 | <% icon_off = design + "_off.png" %> 3 | <% icon_on = design + "_on.png" %> 4 | <% if count != 0 then %> 5 |