This repository has been archived by the owner on Jan 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from akiko-pusu/dev
Ready for release v0.1.2
- Loading branch information
Showing
24 changed files
with
690 additions
and
574 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
inherit_from: .rubocop_todo.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This configuration was generated by | ||
# `rubocop --auto-gen-config` | ||
# on 2016-06-01 07:37:41 +0900 using RuboCop version 0.40.0. | ||
# The point is for the user to remove these configuration records | ||
# one by one as the offenses are removed from the code base. | ||
# Note that changes in the inspected code, or installation of new | ||
# versions of RuboCop, may require this file to be generated again. | ||
|
||
# Offense count: 3 | ||
Metrics/AbcSize: | ||
Max: 55 | ||
|
||
# Offense count: 1 | ||
# Configuration parameters: CountComments. | ||
Metrics/ClassLength: | ||
Max: 200 | ||
|
||
# "Line is too long"を無効 | ||
Metrics/LineLength: | ||
Enabled: false | ||
|
||
# Offense count: 1 | ||
Metrics/CyclomaticComplexity: | ||
Max: 10 | ||
|
||
# Offense count: 1 | ||
Metrics/PerceivedComplexity: | ||
Max: 10 | ||
|
||
# Avoid methods longer than 10 lines of code | ||
MethodLength: | ||
CountComments: true # count full line comments? | ||
Max: 45 | ||
|
||
# Aboid Missing top-level module documentation comment. | ||
Documentation: | ||
Enabled: false | ||
|
||
EndOfLine: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,33 @@ | ||
class Banner < ActiveRecord::Base | ||
include Redmine::SafeAttributes | ||
unloadable | ||
belongs_to :project | ||
|
||
validates_uniqueness_of :project_id | ||
validates :project_id, :presence => true | ||
validates_inclusion_of :display_part, :in=> ['all', 'new_issue', 'overview','overview_and_issues'] | ||
validates_inclusion_of :style, :in=> ['info','warn','alert', 'normal', 'nodata'] | ||
# project should be stable. | ||
safe_attributes 'banner_description', 'style', 'start_date', 'end_date', 'enabled', 'use_timer', 'display_part' | ||
attr_accessible :enabled, :style, :display_part, :banner_description | ||
|
||
def self.find_or_create(project_id) | ||
banner = Banner.where(['project_id = ?', project_id]).first() | ||
unless banner.present? | ||
banner = Banner.new | ||
banner.project_id = project_id | ||
banner.enabled = false | ||
|
||
# Set default (Also set default by migration file) | ||
banner.display_part = "all" | ||
banner.style = "info" | ||
banner.save! | ||
end | ||
return banner | ||
end | ||
|
||
def enable_banner? | ||
if self.enabled == true && !self.banner_description.blank? | ||
return true | ||
end | ||
return false | ||
end | ||
|
||
end | ||
class Banner < ActiveRecord::Base | ||
include Redmine::SafeAttributes | ||
unloadable | ||
belongs_to :project | ||
|
||
validates_uniqueness_of :project_id | ||
validates :project_id, presence: true | ||
validates_inclusion_of :display_part, in: %w(all new_issue overview overview_and_issues) | ||
validates_inclusion_of :style, in: %w(info warn alert normal nodata) | ||
# project should be stable. | ||
safe_attributes 'banner_description', 'style', 'start_date', 'end_date', 'enabled', 'use_timer', 'display_part' | ||
attr_accessible :enabled, :style, :display_part, :banner_description | ||
|
||
def self.find_or_create(project_id) | ||
banner = Banner.where(['project_id = ?', project_id]).first | ||
unless banner.present? | ||
banner = Banner.new | ||
banner.project_id = project_id | ||
banner.enabled = false | ||
|
||
# Set default (Also set default by migration file) | ||
banner.display_part = 'all' | ||
banner.style = 'info' | ||
banner.save! | ||
end | ||
banner | ||
end | ||
|
||
def enable_banner? | ||
return true if enabled == true && !banner_description.blank? | ||
false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
<% | ||
-%> | ||
<%= render :partial=>'banner/body_bottom' %> | ||
<%= render 'banner/body_bottom' %> | ||
<script type="text/javascript"> | ||
$(document).ready(function(){ | ||
$('#banner_area').insertAfter($('#top-menu')); | ||
$(document).ready(function () { | ||
displayTopBanner(); | ||
}); | ||
|
||
$(window).resize(function () { | ||
console.log("resize"); | ||
displayTopBanner(); | ||
}); | ||
</script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.