added speed selection

This commit is contained in:
Keith 2016-10-24 14:23:35 +08:00
parent 0edcec7c2b
commit 50ca7448e3
5 changed files with 33 additions and 2 deletions

View File

@ -6,6 +6,7 @@ class TextMarqueesController < ApplicationController
texts = marquee.marquee_texts.collect do |mqt| texts = marquee.marquee_texts.collect do |mqt|
{ {
"text" => mqt.title, "text" => mqt.title,
"speed" => mqt.speed,
"url" => (mqt.url || "") "url" => (mqt.url || "")
} }
end end

View File

@ -4,6 +4,7 @@ class MarqueeText
field :title, type: String, localize: true field :title, type: String, localize: true
field :url, type: String, localize: true field :url, type: String, localize: true
field :speed, type: Integer, default: 3000
belongs_to :marquee belongs_to :marquee
end end

View File

@ -7,6 +7,30 @@
<%= javascript_include_tag "validator" %> <%= javascript_include_tag "validator" %>
<% end %> <% end %>
<!-- Module -->
<div class="input-area">
<div class="nav-name"><strong><%= t(:module) %></strong></div>
<ul class="nav nav-pills module-nav">
<li class="active"><a href="#basic" data-toggle="tab"><%= t(:basic) %></a></li>
</ul>
<!-- Module -->
<div class="tab-content module-area">
<!-- Basic Module -->
<div class="tab-pane fade in active" id="basic">
<!-- transition speed -->
<div class="control-group">
<%= f.label :speed, t('text_marquee.speed'), class: "control-label muted" %>
<div class="controls">
<%= f.number_field :speed, in: 3000..15000, step: 1000, class: "input-mini" %>
<span class="help-block"><%= t('text_marquee.unit') %></span>
</div>
</div>
</div>
</div>
</div>
<!-- Input Area --> <!-- Input Area -->
<div class="input-area"> <div class="input-area">
@ -56,6 +80,7 @@
</div> </div>
<!-- Form Actions --> <!-- Form Actions -->
<div class="form-actions"> <div class="form-actions">
<%= f.submit t('submit'), class: 'btn btn-primary' %> <%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), admin_text_marquee_path(@marquee), :class=>"btn" %> <%= link_to t('cancel'), admin_text_marquee_path(@marquee), :class=>"btn" %>

View File

@ -5,6 +5,8 @@ en:
new: New new: New
marquee_name: Marquee Name marquee_name: Marquee Name
categories: Category categories: Category
unit: Unit Millisecond
speed: Speed
default_widget: default_widget:
to_more: Read More to_more: Read More
text_marquee_category_with_title: Category text_marquee_category_with_title: Category

View File

@ -5,6 +5,8 @@ zh_tw:
new: New new: New
marquee_name: Marquee Name marquee_name: Marquee Name
categories: Category categories: Category
speed: 轉換速度
unit: 單位:毫秒
default_widget: default_widget:
to_more: Read More to_more: Read More
text_marquee_category_with_title: Category text_marquee_category_with_title: Category