diff --git a/app/controllers/text_marquees_controller.rb b/app/controllers/text_marquees_controller.rb index d8dd4bd..eccaa2e 100644 --- a/app/controllers/text_marquees_controller.rb +++ b/app/controllers/text_marquees_controller.rb @@ -6,6 +6,7 @@ class TextMarqueesController < ApplicationController texts = marquee.marquee_texts.collect do |mqt| { "text" => mqt.title, + "speed" => mqt.speed, "url" => (mqt.url || "") } end diff --git a/app/models/marquee_text.rb b/app/models/marquee_text.rb index b240553..68bd0c8 100644 --- a/app/models/marquee_text.rb +++ b/app/models/marquee_text.rb @@ -4,6 +4,7 @@ class MarqueeText field :title, type: String, localize: true field :url, type: String, localize: true - + field :speed, type: Integer, default: 3000 + belongs_to :marquee end \ No newline at end of file diff --git a/app/views/admin/text_marquees/_text_form.html.erb b/app/views/admin/text_marquees/_text_form.html.erb index 5c3be6d..58d44a8 100644 --- a/app/views/admin/text_marquees/_text_form.html.erb +++ b/app/views/admin/text_marquees/_text_form.html.erb @@ -2,11 +2,35 @@ <%= stylesheet_link_tag "lib/main-forms" %> <% end %> <% content_for :page_specific_javascript do %> - <%= javascript_include_tag "lib/bootstrap-fileupload" %> + <%= javascript_include_tag "lib/bootstrap-fileupload" %> <%= javascript_include_tag "lib/module-area" %> <%= javascript_include_tag "validator" %> <% end %> + +
+ + + + +
+ + +
+ +
+ <%= f.label :speed, t('text_marquee.speed'), class: "control-label muted" %> +
+ <%= f.number_field :speed, in: 3000..15000, step: 1000, class: "input-mini" %> + <%= t('text_marquee.unit') %> +
+
+
+
+
+
@@ -56,6 +80,7 @@
+
<%= f.submit t('submit'), class: 'btn btn-primary' %> <%= link_to t('cancel'), admin_text_marquee_path(@marquee), :class=>"btn" %> diff --git a/config/locales/en.yml b/config/locales/en.yml index b5eb604..b79aa20 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -5,6 +5,8 @@ en: new: New marquee_name: Marquee Name categories: Category + unit: Unit Millisecond + speed: Speed default_widget: to_more: Read More text_marquee_category_with_title: Category diff --git a/config/locales/zh_tw.yml b/config/locales/zh_tw.yml index 820a05f..0f0adea 100644 --- a/config/locales/zh_tw.yml +++ b/config/locales/zh_tw.yml @@ -5,6 +5,8 @@ zh_tw: new: New marquee_name: Marquee Name categories: Category + speed: 轉換速度 + unit: 單位:毫秒 default_widget: to_more: Read More text_marquee_category_with_title: Category