Class: Workarea::Sort

Inherits:
Struct
  • Object
show all
Defined in:
app/models/workarea/sort.rb

Defined Under Namespace

Classes: Collection

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#directionObject

Returns the value of attribute direction

Returns:

  • (Object)

    the current value of direction



2
3
4
# File 'app/models/workarea/sort.rb', line 2

def direction
  @direction
end

#fieldObject

Returns the value of attribute field

Returns:

  • (Object)

    the current value of field



2
3
4
# File 'app/models/workarea/sort.rb', line 2

def field
  @field
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



2
3
4
# File 'app/models/workarea/sort.rb', line 2

def name
  @name
end

#slugObject

Returns the value of attribute slug

Returns:

  • (Object)

    the current value of slug



2
3
4
# File 'app/models/workarea/sort.rb', line 2

def slug
  @slug
end

Class Method Details

.availableObject



21
22
23
# File 'app/models/workarea/sort.rb', line 21

def self.available
  new(I18n.t('workarea.sorts.available'),         :available,     :available,             :desc)
end

.average_order_valueObject



25
26
27
# File 'app/models/workarea/sort.rb', line 25

def self.average_order_value
  new(I18n.t('workarea.sorts.average_order_value'),  :avg_order,     :average_order_value,   :desc)
end

.countryObject



153
154
155
# File 'app/models/workarea/sort.rb', line 153

def self.country
  new(I18n.t('workarea.sorts.country'),           :country, :country,       :asc)
end

.destinationObject



29
30
31
# File 'app/models/workarea/sort.rb', line 29

def self.destination
  new(I18n.t('workarea.sorts.destination'),       :destination,   :destination,           :asc)
end

.downloadsObject



37
38
39
# File 'app/models/workarea/sort.rb', line 37

def self.downloads
  new(I18n.t('workarea.sorts.downloads'),        :downloads,     :downloads,              :desc)
end

.endObject



33
34
35
# File 'app/models/workarea/sort.rb', line 33

def self.end
  new(I18n.t('workarea.sorts.end'),               :end,           :active_ends_at,        :desc)
end

.last_updatedObject



41
42
43
# File 'app/models/workarea/sort.rb', line 41

def self.last_updated
  new(I18n.t('workarea.sorts.last_updated'),      :last_updated,  :updated_at,            :desc)
end

.modifiedObject



45
46
47
# File 'app/models/workarea/sort.rb', line 45

def self.modified
  new(I18n.t('workarea.sorts.modified'),          :modified,      :updated_at,            :desc)
end

.most_ordersObject



49
50
51
# File 'app/models/workarea/sort.rb', line 49

def self.most_orders
  new(I18n.t('workarea.sorts.most_orders'),       :most_orders,   :total_orders,          :desc)
end

.most_spentObject



53
54
55
# File 'app/models/workarea/sort.rb', line 53

def self.most_spent
  new(I18n.t('workarea.sorts.most_spent'),        :most_spent,    :total_spent,           :desc)
end

.name_ascObject



57
58
59
# File 'app/models/workarea/sort.rb', line 57

def self.name_asc
  new(I18n.t('workarea.sorts.name_asc'),          :name_asc,      :name,                  :asc)
end

.name_descObject



61
62
63
# File 'app/models/workarea/sort.rb', line 61

def self.name_desc
  new(I18n.t('workarea.sorts.name_desc'),         :name_desc,     :name,                  :desc)
end

.newestObject



65
66
67
# File 'app/models/workarea/sort.rb', line 65

def self.newest
  new(I18n.t('workarea.sorts.newest'),            :newest,        :created_at,            :desc)
end

.newest_placedObject



69
70
71
# File 'app/models/workarea/sort.rb', line 69

def self.newest_placed
  new(I18n.t('workarea.sorts.newest'),            :newest_placed, :placed_at,             :desc)
end

.oldestObject



73
74
75
# File 'app/models/workarea/sort.rb', line 73

def self.oldest
  new(I18n.t('workarea.sorts.oldest'),            :oldest,        :created_at,            :asc)
end

.oldest_placedObject



77
78
79
# File 'app/models/workarea/sort.rb', line 77

def self.oldest_placed
  new(I18n.t('workarea.sorts.oldest'),            :oldest_placed, :placed_at,             :asc)
end

.pathObject



81
82
83
# File 'app/models/workarea/sort.rb', line 81

def self.path
  new(I18n.t('workarea.sorts.path'),              :path,          :path,                  :asc)
end

.pendingObject



85
86
87
# File 'app/models/workarea/sort.rb', line 85

def self.pending
  new(I18n.t('workarea.sorts.pending'),           :pending,       :pending,               :desc)
end

.popularityObject



89
90
91
# File 'app/models/workarea/sort.rb', line 89

def self.popularity
  new(I18n.t('workarea.sorts.popularity'),       :popularity,     :'sorts.views_score',   :desc)
end

.postal_codeObject



157
158
159
# File 'app/models/workarea/sort.rb', line 157

def self.postal_code
  new(I18n.t('workarea.sorts.postal_code'),       :postal_code, :postal_code,   :asc)
end

.price_ascObject



93
94
95
# File 'app/models/workarea/sort.rb', line 93

def self.price_asc
  new(I18n.t('workarea.sorts.price_asc'),         :price_asc,     :'sorts.price',         :asc)
end

.price_descObject



97
98
99
# File 'app/models/workarea/sort.rb', line 97

def self.price_desc
  new(I18n.t('workarea.sorts.price_desc'),        :price_desc,    :'sorts.price',         :desc)
end

.published_dateObject



149
150
151
# File 'app/models/workarea/sort.rb', line 149

def self.published_date
  new(I18n.t('workarea.sorts.published_date'),    :published_date, :published_at,         :desc)
end

.purchasedObject



101
102
103
# File 'app/models/workarea/sort.rb', line 101

def self.purchased
  new(I18n.t('workarea.sorts.purchased'),         :purchased,     :purchased,             :desc)
end

.queryObject



105
106
107
# File 'app/models/workarea/sort.rb', line 105

def self.query
  new(I18n.t('workarea.sorts.query'),             :query,         :query,                 :asc)
end

.ratingObject



109
110
111
# File 'app/models/workarea/sort.rb', line 109

def self.rating
  new(I18n.t('workarea.sorts.rating'),            :rating,        :rating,                :desc)
end

.redemptionsObject



113
114
115
# File 'app/models/workarea/sort.rb', line 113

def self.redemptions
  new(I18n.t('workarea.sorts.redemptions'),       :redemptions,   :total_redemptions,     :desc)
end

.regionObject



161
162
163
# File 'app/models/workarea/sort.rb', line 161

def self.region
  new(I18n.t('workarea.sorts.region'),            :region, :region,        :asc)
end

.relevanceObject



117
118
119
# File 'app/models/workarea/sort.rb', line 117

def self.relevance
  new(I18n.t('workarea.sorts.relevance'),         :relevance,      nil,                   nil)
end

.salesObject



121
122
123
# File 'app/models/workarea/sort.rb', line 121

def self.sales
  new(I18n.t('workarea.sorts.sales'),             :sales,         :sales,                 :desc)
end

.skuObject



125
126
127
# File 'app/models/workarea/sort.rb', line 125

def self.sku
  new(I18n.t('workarea.sorts.sku'),               :sku,           :id,                    :asc)
end

.startObject



129
130
131
# File 'app/models/workarea/sort.rb', line 129

def self.start
  new(I18n.t('workarea.sorts.start'),             :start,         :active_starts_at,      :desc)
end

.titleObject



133
134
135
# File 'app/models/workarea/sort.rb', line 133

def self.title
  new(I18n.t('workarea.sorts.title'),             :title,         :title,                 :asc)
end

.top_sellersObject



137
138
139
# File 'app/models/workarea/sort.rb', line 137

def self.top_sellers
  new(I18n.t('workarea.sorts.top_sellers'),       :top_sellers,   :'sorts.orders_score',  :desc)
end

.totalObject



141
142
143
# File 'app/models/workarea/sort.rb', line 141

def self.total
  new(I18n.t('workarea.sorts.total'),             :total,         :total_price,           :desc)
end

.typeObject



145
146
147
# File 'app/models/workarea/sort.rb', line 145

def self.type
  new(I18n.t('workarea.sorts.type'),              :type,          :type,                  :asc)
end

Instance Method Details

#to_aObject



17
18
19
# File 'app/models/workarea/sort.rb', line 17

def to_a
  [name, slug]
end

#to_sObject



13
14
15
# File 'app/models/workarea/sort.rb', line 13

def to_s
  self.slug.to_s
end