add some styling on tables view
This commit is contained in:
@@ -26,6 +26,12 @@ class List
|
||||
}
|
||||
}|, reduce_function: '_sum'
|
||||
|
||||
view :active_by_section_id_view, type: :custom, map_function: %|function(doc){
|
||||
if(doc.ruby_class == 'List' && doc.state == 'active' && doc.section_id){
|
||||
emit(doc.section_id, 1);
|
||||
}
|
||||
}|, reduce_function: '_sum'
|
||||
|
||||
view :for_user_view, type: :custom, map_function: %|function(doc){
|
||||
if(doc.ruby_class == 'List' && doc.user_ids && doc.user_ids.length){
|
||||
doc.user_ids.forEach(function(uid){
|
||||
@@ -45,6 +51,10 @@ class List
|
||||
list
|
||||
end
|
||||
|
||||
def self.active_for_section(section_id, options = {})
|
||||
database.view(active_by_section_id_view(key: section_id, reduce: false, include_docs: true))
|
||||
end
|
||||
|
||||
def self.for_user(user, options = {})
|
||||
with_pagination_options(options) do |options|
|
||||
database.view(for_user_view({startkey: ["#{user.id}\u9999"], endkey: [user.id], include_docs: true, reduce: false, descending: true}.merge(options)))
|
||||
|
||||
Reference in New Issue
Block a user