diff --git a/app/models/category.rb b/app/models/category.rb index 974914b0..02dca2ac 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -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 -end \ No newline at end of file + + + # 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 diff --git a/vendor/built_in_modules/location/app/controllers/panel/location/back_end/locations_controller.rb b/vendor/built_in_modules/location/app/controllers/panel/location/back_end/locations_controller.rb index 5594bb7f..936a94ef 100644 --- a/vendor/built_in_modules/location/app/controllers/panel/location/back_end/locations_controller.rb +++ b/vendor/built_in_modules/location/app/controllers/panel/location/back_end/locations_controller.rb @@ -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 diff --git a/vendor/built_in_modules/location/app/models/location.rb b/vendor/built_in_modules/location/app/models/location.rb index 58d032bd..f381e720 100644 --- a/vendor/built_in_modules/location/app/models/location.rb +++ b/vendor/built_in_modules/location/app/models/location.rb @@ -1,6 +1,7 @@ class Location include Mongoid::Document include Mongoid::Timestamps + include OrbitCategory::Categorizable mount_uploader :file, LocationUploader diff --git a/vendor/built_in_modules/location/app/views/panel/location/back_end/locations/_form.html.erb b/vendor/built_in_modules/location/app/views/panel/location/back_end/locations/_form.html.erb index d38b744c..e3d4e53e 100644 --- a/vendor/built_in_modules/location/app/views/panel/location/back_end/locations/_form.html.erb +++ b/vendor/built_in_modules/location/app/views/panel/location/back_end/locations/_form.html.erb @@ -23,6 +23,16 @@ <%= f.text_field :latitude, :class=>"span2", :placeholder => "Langitude" %> + + +