color added to location categories.
This commit is contained in:
		
							parent
							
								
									528f7d28b9
								
							
						
					
					
						commit
						f91c08ce4b
					
				|  | @ -8,7 +8,7 @@ defaults: &defaults | |||
| 
 | ||||
| development: | ||||
|   <<: *defaults | ||||
|   database: orbit_site_new | ||||
|   database: test_site | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -11,3 +11,11 @@ | |||
|     <%= render partial: 'category', collection: @categories %> | ||||
|   </tbody> | ||||
| </table> | ||||
| <div class="bottomnav clearfix"> | ||||
|   <div class="action pull-right"> | ||||
|     <%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t(:add_category), id: 'new', module: @module_app_id.to_s } %> | ||||
|   </div> | ||||
|   <div class="pagination pagination-centered"> | ||||
|     <%= paginate @categories unless @categories.blank? %> | ||||
|   </div> | ||||
| </div> | ||||
|  | @ -0,0 +1,19 @@ | |||
| class Panel::Location::BackEnd::LocationCategoriesController < OrbitBackendController | ||||
| 	def index | ||||
|         @module_app_id = @module_app.id rescue nil | ||||
|     	@categories = get_categories_for_index | ||||
|     	@categories = @categories.page(params[:page]).per(10) | ||||
|     	respond_to do |format| | ||||
|       		format.html # index.html.erb | ||||
|       		format.json { render json: @categories } | ||||
|     	end | ||||
|   end | ||||
| 
 | ||||
|     def list | ||||
|    	    @module_app_id = @module_app.id rescue nil | ||||
|    	    @categories = get_categories_for_index | ||||
|         @categories = @categories.page(params[:page]).per(10) | ||||
|         render :layout => false | ||||
|     end | ||||
| 
 | ||||
| end | ||||
|  | @ -0,0 +1,21 @@ | |||
| <tr class="<%= 'disable' if category.disable %>"> | ||||
|   <% @site_valid_locales.each_with_index do |locale, i| %> | ||||
| 		<td> | ||||
| 			<%= category.title_translations[locale] %> | ||||
| 			<% if i == 0 %> | ||||
| 		      <div class="quick-edit"> | ||||
| 	         	 <ul class="nav nav-pills"> | ||||
| 		          	<% if is_admin?%> | ||||
| 			            <li><%= link_to t(:edit), '#', class: "open-slide", data: {title: t(:edit_category), id: category.id.to_s, module: @module_app_id.to_s, form: category.title_translations.merge(color: category.custom_value)} %></li> | ||||
| 			            <li><%= link_to show_toggle_archive_btn(category), toggle_admin_module_app_category_path(@module_app_id, category), method: :post, remote: true, class: "archive_toggle" %></li> | ||||
| 			           <% end %> | ||||
| 		            <% if is_manager? || is_admin? %> | ||||
| 						<li><%= link_to t(:category_auth), admin_authorizations_path(@module_app.key, 'category_authorization', category.id) %></li> | ||||
| 					<% end %> | ||||
| 	          </ul> | ||||
| 	        </div> | ||||
| 			<% end %> | ||||
| 		</td> | ||||
| 	<% end %> | ||||
| 	<td><span class="badge" style="background-color: <%= category.custom_value %>;"><%= category.custom_value %></span></td> | ||||
| </tr> | ||||
|  | @ -0,0 +1,12 @@ | |||
| <%= flash_messages %> | ||||
| <%= f.error_messages %> | ||||
| <%= label_tag("color", t("location.color")) %> | ||||
| <div class="input-append"> | ||||
|   <%= f.text_field :custom_value, id: "color", :class => "color-picker miniColors input-small", :size => "7", :maxlength => "7", :autocomplete=>"off",:value=>"9100FF" %> | ||||
| </div> | ||||
| <%= f.fields_for :title_translations do |f| %> | ||||
|   <% @site_valid_locales.each do |locale| %> | ||||
| 		<%= label_tag "name-#{locale}", "#{t(:name)} (#{I18nVariable.from_locale(locale)})" %> | ||||
| 		<%= f.text_field locale, :class => 'input-large', :value => (@category.title_translations[locale] rescue ''), placeholder: t(:name), id: locale %> | ||||
|   <% end %> | ||||
| <% end %> | ||||
|  | @ -0,0 +1,66 @@ | |||
| <%= stylesheet_link_tag "jquery.miniColors" %> | ||||
| 
 | ||||
| <%= javascript_include_tag "jquery.miniColors.min" %> | ||||
| 
 | ||||
| <%= javascript_include_tag "admin/categories" %> | ||||
| 
 | ||||
| <div id="categories_index"> | ||||
|    <table class="table main-list"> | ||||
|     <thead> | ||||
|       <tr class="sort-header"> | ||||
|         <% @site_valid_locales.each_with_index do |locale, i| %> | ||||
|           <th class="<%= 'span5' if i <= 1  %>"><a href="#"><%= t(:_locale, :locale => locale) %></a></th> | ||||
|         <% end %> | ||||
|         <th class="span2"><a href="#"><%= t('event_category.color') %></a></th> | ||||
|       </tr> | ||||
|     </thead> | ||||
|     <tbody> | ||||
|       <%= render partial: 'category', collection: @categories %> | ||||
|     </tbody> | ||||
|   </table> | ||||
| 
 | ||||
| 
 | ||||
| <div class="bottomnav clearfix"> | ||||
|   <div class="action pull-right"> | ||||
|     <%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t(:add_category), id: 'new', module: @module_app_id.to_s } %> | ||||
|   </div> | ||||
|   <div class="pagination pagination-centered"> | ||||
|     <%= paginate @categories unless @categories.blank? %> | ||||
|   </div> | ||||
| </div> | ||||
| </div> | ||||
| <div id="pageslide"> | ||||
|   <div class="page-title clearfix"> | ||||
|     <a class="pull-right" href="javascript:$.pageslide.close()"> | ||||
|       <i class="icons-arrow-left-2"></i> | ||||
|     </a> | ||||
|     <span></span> | ||||
|   </div> | ||||
|   <div class="view-page"> | ||||
|     <div class="nano"> | ||||
|       <div class="content"> | ||||
|         <%= form_for :category, url: nil, html:{:id=>"color"}, remote: true do |f| %> | ||||
|           <fieldset> | ||||
|             <%= render :partial => "form", :locals => { :f => f } %> | ||||
|             <div class="form-actions"> | ||||
|               <a href="javascript:$.pageslide.close()" class="btn btn-small"><%= t(:cancel) %></a> | ||||
|               <%= f.submit t(:submit), class: 'btn btn-primary btn-small' %> | ||||
|             </div> | ||||
|           </fieldset> | ||||
|         <% end %> | ||||
|       </div> | ||||
|     </div> | ||||
|   </div> | ||||
| </div> | ||||
| <script type="text/javascript"> | ||||
| if($('.color-picker').length > 0){ | ||||
|     $('.color-picker').miniColors(); // just in category view | ||||
|     $('.miniColors-trigger').addClass('btn'); | ||||
| } | ||||
| $("form#color").bind("ajax:complete",function(){ | ||||
|   $.get("<%= panel_location_back_end_location_categories_list_path %>",function(data){ | ||||
|     $("#categories_index").html(data); | ||||
|     openSlide(); | ||||
|   }) | ||||
| }) | ||||
| </script> | ||||
|  | @ -0,0 +1,21 @@ | |||
| <table class="table main-list"> | ||||
|   <thead> | ||||
|     <tr class="sort-header"> | ||||
|       <% @site_valid_locales.each_with_index do |locale, i| %> | ||||
|         <th class="<%= 'span5' if i <= 1  %>"><a href="#"><%= t(:_locale, :locale => locale) %></a></th> | ||||
|       <% end %> | ||||
|       <th class="span2"><a href="#"><%= t('location_category.color') %></a></th> | ||||
|     </tr> | ||||
|   </thead> | ||||
|   <tbody> | ||||
|     <%= render partial: 'category', collection: @categories %> | ||||
|   </tbody> | ||||
| </table> | ||||
| <div class="bottomnav clearfix"> | ||||
|   <div class="action pull-right"> | ||||
|     <%= link_to content_tag(:i, nil, class: "icons-plus") + " " + t(:add), '#', class: "btn btn-primary open-slide", data: {title: t(:add_category), id: 'new', module: @module_app_id.to_s } %> | ||||
|   </div> | ||||
|   <div class="pagination pagination-centered"> | ||||
|     <%= paginate @categories unless @categories.blank? %> | ||||
|   </div> | ||||
| </div> | ||||
|  | @ -2,7 +2,8 @@ Rails.application.routes.draw do | |||
|   namespace :panel do | ||||
|     namespace :location do | ||||
|       namespace :back_end do  | ||||
| 
 | ||||
|       	match 'location_categories/list' => "location_categories#list" | ||||
| 	    resources :location_categories | ||||
|         match "locations/get_locations" => "locations#get_locations" | ||||
|          match "locations/get_categories" => "locations#get_categories" | ||||
| 
 | ||||
|  |  | |||
|  | @ -37,27 +37,27 @@ module Location | |||
|     side_bar do | ||||
|       head_label_i18n  'location.location',:icon_class=>"icons-location" | ||||
|       available_for [:admin,:guest,:manager,:sub_manager] | ||||
|       active_for_controllers ({:private=>['locations']}) | ||||
|       active_for_controllers ({:private=>['locations','location_categories']}) | ||||
| 
 | ||||
|       head_link_path "panel_location_back_end_locations_path" | ||||
| 
 | ||||
|       context_link 'location.all_locations', | ||||
|                      :link_path=>"panel_location_back_end_locations_path" , | ||||
|                      :priority=>1, | ||||
|                      :active_for_action=>{:localtions=>:index}, | ||||
|                      :active_for_action=>{:locations=>:index}, | ||||
|                      :available_for => [:manager] | ||||
| 
 | ||||
|       context_link 'location.add_location', | ||||
|                      :link_path=>"new_panel_location_back_end_location_path" , | ||||
|                      :priority=>1, | ||||
|                      :active_for_action=>{:localtions=>:new}, | ||||
|                      :active_for_action=>{:locations=>:new}, | ||||
|                      :available_for => [:manager] | ||||
| 
 | ||||
| 
 | ||||
|       context_link 'location.categories', | ||||
|                      :link_path=>"admin_module_app_categories_path(get_module_app)" , | ||||
|                      :link_path=>"panel_location_back_end_location_categories_path" , | ||||
|                      :priority=>1, | ||||
|                      :active_for_action=>{:localtion_categories=>:index}, | ||||
|                      :active_for_category => 'Location', | ||||
|                      :available_for => [:manager] | ||||
| 
 | ||||
|     end | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue