app/views/cms/groups/_form.html.erb in browsercms-3.5.7 vs app/views/cms/groups/_form.html.erb in browsercms-4.0.0.alpha
- old
+ new
@@ -1,44 +1,38 @@
<%= content_for :html_head do %>
- <%= stylesheet_link_tag('cms/form_layout') %>
- <style type="text/css">
- .checkbox_group .checkboxes .instructions {
- padding-bottom: 10px;
- }
- </style>
- <%= javascript_tag do %>
- jQuery(function($) {
- $('#group_group_type_id').selectbox();
- });
- <% end %>
-<% end %>
+ <%# Hide permissions based on whether is a CMS User group or not. %>
+ <%= javascript_tag do %>
-<%= content_for :functions do %>
- <%= link_to(span_tag("List All"), groups_path,
- :id => "list_all_button",
- :class => "button") %>
+ jQuery(function($){
+ var element = $('#group_group_type_id');
+ var cms_access_group_ids = <%= Cms::GroupType.cms_access.to_a.map { |e| e.id.to_s }.to_json.html_safe %>
+ element.change(function() {
+ if ($.inArray(element[0].value, cms_access_group_ids) < 0) {
+ $('#permissions').hide();
+ $('#section-action').text('view');
+ } else {
+ $('#permissions').show();
+ $('#section-action').text('edit');
+ }
+ }).change();
+ });
+ <% end %>
<% end %>
-<%= form_for @group do |f| %>
- <%= f.cms_error_messages %>
- <div class="fields text_fields">
- <%= f.label :name, "Group Name" %>
- <%= f.text_field :name %>
- </div>
+<%= simple_form_for @group do |f| %>
+ <%= page_title_with_buttons(f, 'save_buttons') %>
+ <%= render layout: 'main_with_sidebar' do %>
+ <%= f.input :name, label: "Group Name" %>
+ <% unless @group.guest? %>
+ <%= f.association :group_type,
+ collection: Cms::GroupType.non_guest,
+ label: 'Type of User',
+ hint: 'What kind of user does this group represent?',
+ include_blank: false
+ %>
+ <% end %>
- <% unless @group.guest? %>
- <div class="fields select_fields">
- <%= f.label :group_type_id, "Type of User" %>
- <div><%= f.select :group_type_id, Cms::GroupType.non_guest.map { |g| [g.name, g.id] } %></div>
- <div class="instructions">What kind of user does this group represent?</div>
- <br clear="all" />
- </div>
- <% end %>
-
- <%= render :partial => 'permissions' %>
- <%= render :partial => 'sections' %>
-
- <div class="buttons">
- <%= lt_button_wrapper(f.submit("Save", :class => "submit")) %>
- </div>
-
+ <%= render :partial => 'permissions', locals: {f: f} %>
+ <%= render :partial => 'sections', locals: {f: f} %>
+ <% end %>
+ <%= bottom_buttons f, 'save_buttons' %>
<% end %>