Location - category fixes
Conflicts: app/models/category.rb vendor/built_in_modules/location/init.rb
This commit is contained in:
		
							parent
							
								
									109b891b27
								
							
						
					
					
						commit
						7ea9945af0
					
				| 
						 | 
				
			
			@ -5,6 +5,8 @@ class Category
 | 
			
		|||
 | 
			
		||||
  field :disable, type: Boolean, default: false
 | 
			
		||||
  field :title, localize: true
 | 
			
		||||
  field :custom, type: Boolean, default: false
 | 
			
		||||
  field :custom_value
 | 
			
		||||
 | 
			
		||||
  validates :title, :at_least_one => true
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -12,5 +14,26 @@ class Category
 | 
			
		|||
  has_many :buffer_categories
 | 
			
		||||
 | 
			
		||||
  scope :enabled, where(:disable.in => [false, nil, ''])
 | 
			
		||||
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      # base.instance_eval("scope :admin_manager_all,find(:all)")
 | 
			
		||||
      
 | 
			
		||||
      # base.define_singleton_method :find do |*args|
 | 
			
		||||
      #   if args ==[:all]
 | 
			
		||||
      #     unscoped
 | 
			
		||||
      #   else
 | 
			
		||||
      #     res = unscoped.find(args) 
 | 
			
		||||
      #     res.count == 1 ? res[0] : res
 | 
			
		||||
      #   end
 | 
			
		||||
      # end
 | 
			
		||||
 | 
			
		||||
      # base.define_singleton_method :first do |*args|
 | 
			
		||||
      #   all.first
 | 
			
		||||
      # end
 | 
			
		||||
 | 
			
		||||
      # base.define_singleton_method :last do |*args|
 | 
			
		||||
      #   all.last
 | 
			
		||||
      # end
 | 
			
		||||
>>>>>>> 87741bf... Location - category fixes
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController
 | 
			
		|||
 | 
			
		||||
  def index
 | 
			
		||||
    @location_infos = LocationInfo.all
 | 
			
		||||
    @categories = get_categories_for_index
 | 
			
		||||
    respond_to do |format|
 | 
			
		||||
      format.html # new.html.erb
 | 
			
		||||
      format.json { render json: @locations }
 | 
			
		||||
| 
						 | 
				
			
			@ -14,6 +15,7 @@ class Panel::Location::BackEnd::LocationsController < OrbitBackendController
 | 
			
		|||
 | 
			
		||||
  def new
 | 
			
		||||
    @location_info = LocationInfo.new
 | 
			
		||||
    @categories = get_categories_for_index
 | 
			
		||||
 | 
			
		||||
    respond_to do |format|
 | 
			
		||||
      format.html # new.html.erb
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
class Location
 | 
			
		||||
  include Mongoid::Document
 | 
			
		||||
  include Mongoid::Timestamps
 | 
			
		||||
  include OrbitCategory::Categorizable
 | 
			
		||||
 | 
			
		||||
  mount_uploader :file, LocationUploader
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,6 +23,16 @@
 | 
			
		|||
      <%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
   <!-- Category -->
 | 
			
		||||
  <div class="control-group">
 | 
			
		||||
    <label class="control-label muted"><%= t(:category) %></label>
 | 
			
		||||
    <div class="controls">
 | 
			
		||||
      <%= f.select :category_id, @categories.collect{|t| [ t.title, t.id ]} %>
 | 
			
		||||
    </div>
 | 
			
		||||
  </div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  <div class="control-group">
 | 
			
		||||
    <label class="control-label" for=""><%= t 'description' %></label>
 | 
			
		||||
    <div class="controls">
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,6 +31,8 @@ module Location
 | 
			
		|||
    #   # item "bulletins_and_web_links","location.widget.bulletins_and_web_links"
 | 
			
		||||
    # end
 | 
			
		||||
 | 
			
		||||
    categorizable
 | 
			
		||||
    
 | 
			
		||||
    side_bar do
 | 
			
		||||
      head_label_i18n  'location.location',:icon_class=>"icons-location"
 | 
			
		||||
      available_for [:admin,:guest,:manager,:sub_manager]
 | 
			
		||||
| 
						 | 
				
			
			@ -38,6 +40,25 @@ module Location
 | 
			
		|||
 | 
			
		||||
      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},
 | 
			
		||||
                     :available_for => [:manager]
 | 
			
		||||
 | 
			
		||||
      context_link 'location.add_location',
 | 
			
		||||
                     :link_path=>"new_panel_location_back_end_location_path" ,
 | 
			
		||||
                     :priority=>1,
 | 
			
		||||
                     :active_for_action=>{:localtions=>:new},
 | 
			
		||||
                     :available_for => [:manager]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      context_link 'location.categories',
 | 
			
		||||
                     :link_path=>"admin_module_app_categories_path(get_module_app)" ,
 | 
			
		||||
                     :priority=>1,
 | 
			
		||||
                     :active_for_action=>{:localtion_categories=>:index},
 | 
			
		||||
                     :available_for => [:manager]
 | 
			
		||||
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue