Skip to content

Commit

Permalink
Merge pull request #6 from zaneli/redmine3
Browse files Browse the repository at this point in the history
Redmine 3.x support
  • Loading branch information
zaneli committed Oct 19, 2015
2 parents 9ee77cf + 6c8e62d commit 9b6b449
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ This is Redmine plugin to extend mail settings.

## Versions that is confirmed to working

* Redmine version 2.5.2.stable
* Ruby version 2.0.0-p481 (2014-05-08) [x86_64-linux]
* Rails version 3.2.19
* Redmine version 3.1.0.stable
* Ruby version 1.9.3-p551 (2014-11-13) [x86_64-linux]
* Rails version 4.2.3

## Getting started

Expand All @@ -23,7 +23,7 @@ or download source code, unzip (or extract the archive), and move directories to
### 2. Run db migration

```
rake redmine:plugins:migrate RAILS_ENV=<development or production>
rake redmine:plugins:migrate RAILS_ENV=<development or production>
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/akayagi_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class AkayagiController < ApplicationController
def save
project = Project::find(params[:project_id])
begin
@settings = AkayagiProjectSettings::find_or_create_by_project_id(project.id)
@settings = AkayagiProjectSettings::find_or_create_by(project_id: project.id)
@settings.subject_prefix = params[:subject_prefix]
@settings.from_address = params[:from_address]
@settings.to_address = params[:to_address]
Expand Down
4 changes: 2 additions & 2 deletions app/models/akayagi_general_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ class AkayagiGeneralSettings < ActiveRecord::Base
unloadable

def self::find_first_or_create
akayagi_general_settings = self::find(:first)
akayagi_general_settings = self::first
if akayagi_general_settings.nil?
return self::create
end
akayagi_general_settings
end

def self::safe_subject_prefix
akayagi_general_settings = self::find(:first)
akayagi_general_settings = self::first
if akayagi_general_settings.nil?
""
else
Expand Down
8 changes: 4 additions & 4 deletions app/views/akayagi/_settings.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<%
@settings = AkayagiProjectSettings::find_or_create_by_project_id(@project.id)
@settings = AkayagiProjectSettings::find_or_create_by(project_id: @project.id)
@general_subject_prefix = AkayagiGeneralSettings::safe_subject_prefix
%>

<script type="text/javascript">
$(function() {
$("#enable_subject_prefix").click(function() {
var checked = $("#enable_subject_prefix").attr("checked");
var checked = $("#enable_subject_prefix").prop("checked");
if (checked) {
$("#subject_prefix").attr("disabled", false);
$("#subject_prefix").prop("disabled", false);
$("#subject_prefix").val("");
} else {
$("#subject_prefix").attr("disabled", true);
$("#subject_prefix").prop("disabled", true);
$("#subject_prefix").val($("#general_subject_prefix").val());
}
});
Expand Down
2 changes: 1 addition & 1 deletion app/views/settings/_notifications.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
</fieldset>

<div style="float:right;">
<%= link_to l(:label_send_test_email), :controller => 'admin', :action => 'test_email' %>
<%= link_to l(:label_send_test_email), { :controller => 'admin', :action => 'test_email' }, :method => :post %>
</div>

<%= submit_tag l(:button_save) %>
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RedmineApp::Application.routes.draw do
match '/akayagi/save', :to => 'akayagi#save'
match '/akayagi/save', :to => 'akayagi#save', :via => [:post, :patch]
end

4 changes: 2 additions & 2 deletions init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

Redmine::Plugin.register :akayagi do
name 'Akayagi plugin'
author 'Shunsuke Ohtani'
author 'Shunsuke Otani'
description 'Mail settings extension'
version '0.0.2'
version '0.0.3'
url 'https://github.com/zaneli/akayagi'
author_url 'http://www.zaneli.com/'

Expand Down

0 comments on commit 9b6b449

Please sign in to comment.