fix some bug in structure page form

This commit is contained in:
manson 2014-08-01 21:05:21 +08:00
parent f3882eee10
commit c5b501845c
4 changed files with 35 additions and 42 deletions

View File

@ -3,7 +3,7 @@
<% end %>
<div class="control-group">
<% if params[:action] == "new" %>
<%= f.label :name, content_tag(:i, nil, :class => "icons-star") + t(:name) %>
<%= f.label :name, content_tag(:i, nil, :class => "icons-star") + t(:page)+' ID' %>
<div class="controls">
<%= f.text_field :page_id, class:"input-xlarge change", data: {"fv-validation" => "required;nospace;pageid_validation;", "fv-messages" => "Cannot be empty.;Cannot have blank spaces.;Page id is already taken.;"} %>
<span class="help-block"><%= t("front_page.name_field_helper") %></span>

View File

@ -3,9 +3,10 @@
<% end %>
<div class="control-group">
<% if params[:action] == "new" %>
<%= f.label :name, content_tag(:i, nil, :class => "icons-star") + t(:name) %>
<%= f.label :name, content_tag(:i, nil, :class => "icons-star")+t(:link)+' ID' %>
<div class="controls">
<%= f.text_field :page_id, class: "input-xlarge change", data: {"fv-validation" => "required;nospace;pageid_validation;", "fv-messages" => "Cannot be empty.;Cannot have blank spaces;Page id is already taken.;"} %>
<span class="help-block"><%= t("front_page.name_field_helper") %></span>
</div>
<% end %>
<div class="controls">
@ -16,7 +17,7 @@
<div class="control-group">
<% @site_in_use_locales.each do |locale| %>
<label class="control-label">Link name (<%= t(locale.to_s) %>) :</label>
<label class="control-label"><%= "#{t(:title)} #{t(locale)}" %></label>
<div class="controls">
<%= f.fields_for :name_translations do |n| %>
<%= n.text_field locale, class:"input-xlarge change", data: {"fv-validation" => "required;", "fv-messages" => "Cannot be empty.;"}, :value=>@page.name_translations[locale] rescue nil %>
@ -26,11 +27,11 @@
</div>
<div class="control-group">
<% @site_in_use_locales.each do |locale| %>
<label class="control-label">Url (<%= t(locale.to_s) %>) :</label>
<label class="control-label"><%= "#{t(:url)} #{t(locale)}" %></label>
<div class="controls">
<%= f.fields_for :external_url_translations do |n| %>
<%
if params[:action] == "edit"
if params[:action] == "edit" and !@page.external_url_translations[locale].blank?
temp_url = @page.external_url_translations[locale]
temp_url = URI.parse(temp_url)
url = ""

View File

@ -6,12 +6,8 @@
<% end %>
<div class="form-actions">
<% if params[:type] == "page" %>
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
<%= f.submit t(:submit), class: 'btn btn-primary btn-small' %>
<% elsif params[:type] == "link" %>
<%= f.submit "Update Link", :class=>"btn btn-primary" %>
<% end %>
</div>
<% end %>

View File

@ -6,12 +6,8 @@
<% end %>
<div class="form-actions">
<% if params[:type] == "page" %>
<a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a>
<%= f.submit t(:submit), class: 'btn btn-primary btn-small' %>
<% elsif params[:type] == "link" %>
<%= f.submit "Create Link", :class=>"btn btn-primary" %>
<% end %>
</div>
<% end %>
<script type="text/javascript">