popolo 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +65 -7
- data/app/assets/javascripts/popolo.js +1 -0
- data/app/assets/stylesheets/popolo/bootstrap.min.scss +7 -0
- data/app/assets/stylesheets/popolo/main.css.scss +14 -0
- data/app/assets/stylesheets/popolo.css +3 -0
- data/app/controllers/popolo/memberships_controller.rb +7 -0
- data/app/controllers/popolo/organizations_controller.rb +0 -39
- data/app/controllers/popolo/people_controller.rb +1 -6
- data/app/controllers/popolo/posts_controller.rb +1 -1
- data/app/helpers/popolo_helper.rb +0 -8
- data/app/models/popolo/area.rb +20 -12
- data/app/models/popolo/contact_detail.rb +22 -0
- data/app/models/popolo/count.rb +24 -0
- data/app/models/popolo/date_string.rb +23 -0
- data/app/models/popolo/group_result.rb +15 -0
- data/app/models/popolo/identifier.rb +1 -1
- data/app/models/popolo/link.rb +7 -3
- data/app/models/popolo/membership.rb +34 -9
- data/app/models/popolo/motion.rb +37 -0
- data/app/models/popolo/organization.rb +37 -16
- data/app/models/popolo/other_name.rb +5 -5
- data/app/models/popolo/person.rb +57 -27
- data/app/models/popolo/post.rb +27 -13
- data/app/models/popolo/vote.rb +28 -0
- data/app/models/popolo/vote_event.rb +35 -0
- data/app/views/popolo/contact_details/_contact_detail.html.erb +17 -0
- data/app/views/popolo/identifiers/_identifier.html.erb +2 -0
- data/app/views/popolo/links/_link.html.erb +1 -0
- data/app/views/popolo/memberships/show.html.erb +81 -0
- data/app/views/popolo/organizations/index.html.erb +16 -1
- data/app/views/popolo/organizations/show.html.erb +146 -1
- data/app/views/popolo/other_names/other_name.html.erb +9 -0
- data/app/views/popolo/people/show.html.erb +120 -0
- data/app/views/popolo/posts/show.html.erb +90 -0
- data/config/routes.rb +4 -12
- data/lib/generators/popolo_generator.rb +4 -0
- data/lib/popolo/initializers/pupa_compat.rb +11 -0
- data/lib/popolo/version.rb +1 -1
- data/lib/popolo.rb +17 -5
- data/spec/controllers/popolo/memberships_controller_spec.rb +16 -0
- data/spec/controllers/popolo/organizations_controller_spec.rb +1 -47
- data/spec/controllers/popolo/people_controller_spec.rb +0 -14
- data/spec/controllers/popolo/posts_controller_spec.rb +0 -8
- data/spec/dummy/app/assets/stylesheets/application.css +1 -0
- data/spec/dummy/app/models/cat.rb +0 -3
- data/spec/dummy/app/models/dog.rb +0 -7
- data/spec/dummy/app/views/layouts/application.html.erb +2 -0
- data/spec/dummy/config/locales/en.yml +30 -0
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/log/test.log +8670 -48801
- data/spec/factories.rb +3 -8
- data/spec/models/popolo/{source_spec.rb → contact_detail_spec.rb} +2 -2
- data/spec/models/popolo/count_spec.rb +7 -0
- data/spec/models/popolo/date_string_spec.rb +121 -0
- data/spec/models/popolo/group_result_spec.rb +7 -0
- data/spec/models/popolo/membership_spec.rb +1 -17
- data/spec/models/popolo/motion_spec.rb +5 -0
- data/spec/models/popolo/organization_spec.rb +1 -19
- data/spec/models/popolo/other_name_spec.rb +1 -17
- data/spec/models/popolo/person_spec.rb +23 -19
- data/spec/models/popolo/post_spec.rb +1 -3
- data/spec/models/popolo/vote_event_spec.rb +4 -0
- data/spec/models/popolo/vote_spec.rb +4 -0
- data/spec/popolo_spec.rb +65 -0
- data/spec/routing/popolo/memberships_routing_spec.rb +11 -0
- data/spec/routing/popolo/organizations_routing_spec.rb +1 -19
- data/spec/routing/popolo/people_routing_spec.rb +1 -11
- data/spec/routing/popolo/posts_routing_spec.rb +1 -7
- data/spec/spec_helper.rb +6 -1
- data/spec/support/shared_examples.rb +19 -0
- metadata +99 -109
- data/app/assets/javascripts/popolo/application.js +0 -13
- data/app/assets/stylesheets/popolo/application.css +0 -13
- data/app/controllers/popolo/areas_controller.rb +0 -43
- data/app/models/popolo/address.rb +0 -27
- data/app/models/popolo/event.rb +0 -46
- data/app/models/popolo/source.rb +0 -29
- data/app/views/popolo/addresses/_address.html.erb +0 -16
- data/app/views/popolo/areas/index.html.erb +0 -1
- data/app/views/popolo/areas/show.html.erb +0 -1
- data/app/views/popolo/areas_or_organizations/_breadcrumb.html.erb +0 -13
- data/app/views/popolo/areas_or_organizations/_index.html.erb +0 -31
- data/app/views/popolo/areas_or_organizations/_show.html.erb +0 -18
- data/app/views/popolo/organizations/post.html.erb +0 -27
- data/app/views/popolo/organizations/posts.html.erb +0 -23
- data/app/views/popolo/people/index.html.erb +0 -0
- data/app/views/popolo/posts/index.html.erb +0 -0
- data/lib/popolo/mixins/eventable.rb +0 -15
- data/lib/popolo/mixins/sluggable.rb +0 -66
- data/spec/controllers/popolo/areas_controller_spec.rb +0 -53
- data/spec/dummy/log/development.log +0 -6
- data/spec/models/popolo/address_spec.rb +0 -4
- data/spec/models/popolo/event_spec.rb +0 -7
- data/spec/popolo/mixins/sluggable_spec.rb +0 -153
- data/spec/routing/popolo/areas_routing_spec.rb +0 -25
@@ -1 +1,146 @@
|
|
1
|
-
|
1
|
+
<nav>
|
2
|
+
<ol class="breadcrumb">
|
3
|
+
<li><%= link_to Popolo::Organization.model_name.human(count: Float::INFINITY), organizations_path %></li>
|
4
|
+
<% @organization.ancestors.each do |ancestor| %>
|
5
|
+
<li><%= link_to ancestor, ancestor %></li>
|
6
|
+
<% end %>
|
7
|
+
<li class="active"><%= @organization %></li>
|
8
|
+
</ol>
|
9
|
+
</nav>
|
10
|
+
|
11
|
+
<section>
|
12
|
+
<header class="page-header">
|
13
|
+
<div class="media">
|
14
|
+
<div class="pull-left">
|
15
|
+
<% if @organization.image %>
|
16
|
+
<div class="media-object popolo-circle" style="background-image: url(<%= @organization.image %>)">
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
</div>
|
20
|
+
<div class="media-body">
|
21
|
+
<h1 class="media-heading">
|
22
|
+
<%= @organization %>
|
23
|
+
</h1>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</header>
|
27
|
+
|
28
|
+
<dl>
|
29
|
+
<% if @organization.classification? %>
|
30
|
+
<dt><%= Popolo::Organization.human_attribute_name(:classification) %></dt>
|
31
|
+
<dd><%=t @organization.classification, count: 1, scope: [:popolo, :organizations, :classifications], default: @organization.classification %></dd>
|
32
|
+
<% end %>
|
33
|
+
<% if @organization.founding_date? %>
|
34
|
+
<dt><%= Popolo::Organization.human_attribute_name(:founding_date) %></dt>
|
35
|
+
<dd><%=l @organization.founding_date %></dd>
|
36
|
+
<% end %>
|
37
|
+
<% if @organization.dissolution_date? %>
|
38
|
+
<dt><%= Popolo::Organization.human_attribute_name(:dissolution_date) %></dt>
|
39
|
+
<dd><%=l @organization.dissolution_date %></dd>
|
40
|
+
<% end %>
|
41
|
+
</dl>
|
42
|
+
|
43
|
+
<aside>
|
44
|
+
<% unless @organization.contact_details.empty? %>
|
45
|
+
<section>
|
46
|
+
<header>
|
47
|
+
<h2><%= Popolo::ContactDetail.model_name.human(count: @organization.contact_details.size) %></h2>
|
48
|
+
</header>
|
49
|
+
<dl class="dl-horizontal">
|
50
|
+
<%= render @organization.contact_details %>
|
51
|
+
</dl>
|
52
|
+
</section>
|
53
|
+
<% end %>
|
54
|
+
<% unless @organization.other_names.empty? %>
|
55
|
+
<section>
|
56
|
+
<header>
|
57
|
+
<h2><%= Popolo::OtherName.model_name.human(count: @organization.other_names.size) %></h2>
|
58
|
+
</header>
|
59
|
+
<ul>
|
60
|
+
<%= render @organization.other_names %>
|
61
|
+
</ul>
|
62
|
+
</section>
|
63
|
+
<% end %>
|
64
|
+
<% unless @organization.identifiers.empty? %>
|
65
|
+
<section>
|
66
|
+
<header>
|
67
|
+
<h2><%= Popolo::Identifier.model_name.human(count: @organization.identifiers.size) %></h2>
|
68
|
+
</header>
|
69
|
+
<dl class="dl-horizontal">
|
70
|
+
<%= render @organization.identifiers %>
|
71
|
+
</dl>
|
72
|
+
</section>
|
73
|
+
<% end %>
|
74
|
+
<% unless @organization.links.empty? %>
|
75
|
+
<section>
|
76
|
+
<header>
|
77
|
+
<h2><%= Popolo::Link.model_name.human(count: @organization.links.size) %></h2>
|
78
|
+
</header>
|
79
|
+
<ul>
|
80
|
+
<%= render @organization.links %>
|
81
|
+
</ul>
|
82
|
+
</section>
|
83
|
+
<% end %>
|
84
|
+
<% unless @organization.sources.empty? %>
|
85
|
+
<section>
|
86
|
+
<header>
|
87
|
+
<h2><%=t 'popolo/source', count: @organization.sources.size, scope: [:popolo] %></h2>
|
88
|
+
</header>
|
89
|
+
<ul>
|
90
|
+
<%= render @organization.sources %>
|
91
|
+
</ul>
|
92
|
+
</section>
|
93
|
+
<% end %>
|
94
|
+
</aside>
|
95
|
+
|
96
|
+
<aside>
|
97
|
+
<% unless @organization.memberships.empty? %>
|
98
|
+
<section>
|
99
|
+
<header>
|
100
|
+
<h2>
|
101
|
+
<%= Popolo::Membership.model_name.human(count: @organization.memberships.size) %>
|
102
|
+
</h2>
|
103
|
+
</header>
|
104
|
+
<ol>
|
105
|
+
<% @organization.memberships.each do |membership| %>
|
106
|
+
<li>
|
107
|
+
<%= link_to membership.to_s(format: :person), membership %>
|
108
|
+
</li>
|
109
|
+
<% end %>
|
110
|
+
</ol>
|
111
|
+
</section>
|
112
|
+
<% end %>
|
113
|
+
<% unless @organization.posts.empty? %>
|
114
|
+
<section>
|
115
|
+
<header>
|
116
|
+
<h2>
|
117
|
+
<%= Popolo::Post.model_name.human(count: @organization.posts.size) %>
|
118
|
+
</h2>
|
119
|
+
</header>
|
120
|
+
<ol>
|
121
|
+
<% @organization.posts.each do |post| %>
|
122
|
+
<li>
|
123
|
+
<%= link_to post, post %>
|
124
|
+
</li>
|
125
|
+
<% end %>
|
126
|
+
</ol>
|
127
|
+
</section>
|
128
|
+
<% end %>
|
129
|
+
<% unless @organization.children.empty? %>
|
130
|
+
<section>
|
131
|
+
<header>
|
132
|
+
<h2>
|
133
|
+
<%= Popolo::Organization.model_name.human(count: @organization.children.size) %>
|
134
|
+
</h2>
|
135
|
+
</header>
|
136
|
+
<ol>
|
137
|
+
<% @organization.children.each do |organization| %>
|
138
|
+
<li>
|
139
|
+
<%= link_to organization, organization %>
|
140
|
+
</li>
|
141
|
+
<% end %>
|
142
|
+
</ol>
|
143
|
+
</section>
|
144
|
+
<% end %>
|
145
|
+
</aside>
|
146
|
+
</section>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<li>
|
2
|
+
<%= other_name.name %>
|
3
|
+
<% if other_name.start_date? || other_name.end_date? %>
|
4
|
+
(<%=l other_name.start_date %>—<%=l other_name.end_date %>)
|
5
|
+
<% end %>
|
6
|
+
<% if other_name.note? %>
|
7
|
+
<span class="label label-info"><%= other_name.note %></span>
|
8
|
+
<% end %>
|
9
|
+
</li>
|
@@ -0,0 +1,120 @@
|
|
1
|
+
<section>
|
2
|
+
<header class="page-header">
|
3
|
+
<div class="media">
|
4
|
+
<div class="pull-left">
|
5
|
+
<% if @person.image %>
|
6
|
+
<div class="media-object popolo-circle" style="background-image: url(<%= @person.image %>)">
|
7
|
+
</div>
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
<div class="media-body">
|
11
|
+
<h1 class="media-heading">
|
12
|
+
<%= @person %>
|
13
|
+
</h1>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</header>
|
17
|
+
|
18
|
+
<dl>
|
19
|
+
<% if @person.email? %>
|
20
|
+
<dt><%= Popolo::Person.human_attribute_name(:email) %></dt>
|
21
|
+
<dd><%= mail_to @person.email %></dd>
|
22
|
+
<% end %>
|
23
|
+
<% if @person.gender? %>
|
24
|
+
<dt><%= Popolo::Person.human_attribute_name(:gender) %></dt>
|
25
|
+
<dd><%= @person.gender %></dd>
|
26
|
+
<% end %>
|
27
|
+
<% if @person.national_identity? %>
|
28
|
+
<dt><%= Popolo::Person.human_attribute_name(:national_identity) %></dt>
|
29
|
+
<dd><%= @person.national_identity %></dd>
|
30
|
+
<% end %>
|
31
|
+
<% if @person.birth_date? %>
|
32
|
+
<dt><%= Popolo::Person.human_attribute_name(:birth_date) %></dt>
|
33
|
+
<dd><%=l @person.birth_date %></dd>
|
34
|
+
<% end %>
|
35
|
+
<% if @person.death_date? %>
|
36
|
+
<dt><%= Popolo::Person.human_attribute_name(:death_date) %></dt>
|
37
|
+
<dd><%=l @person.death_date %></dd>
|
38
|
+
<% end %>
|
39
|
+
<% if @person.summary? %>
|
40
|
+
<dt><%= Popolo::Person.human_attribute_name(:summary) %></dt>
|
41
|
+
<dd><%= simple_format @person.summary %></dd>
|
42
|
+
<% end %>
|
43
|
+
<% if @person.biography? %>
|
44
|
+
<dt><%= Popolo::Person.human_attribute_name(:biography) %></dt>
|
45
|
+
<dd><%= simple_format @person.biography %></dd>
|
46
|
+
<% end %>
|
47
|
+
</dl>
|
48
|
+
|
49
|
+
<aside>
|
50
|
+
<% unless @person.contact_details.empty? %>
|
51
|
+
<section>
|
52
|
+
<header>
|
53
|
+
<h2><%= Popolo::ContactDetail.model_name.human(count: @person.contact_details.size) %></h2>
|
54
|
+
</header>
|
55
|
+
<dl class="dl-horizontal">
|
56
|
+
<%= render @person.contact_details %>
|
57
|
+
</dl>
|
58
|
+
</section>
|
59
|
+
<% end %>
|
60
|
+
<% unless @person.other_names.empty? %>
|
61
|
+
<section>
|
62
|
+
<header>
|
63
|
+
<h2><%= Popolo::OtherName.model_name.human(count: @person.other_names.size) %></h2>
|
64
|
+
</header>
|
65
|
+
<ul>
|
66
|
+
<%= render @person.other_names %>
|
67
|
+
</ul>
|
68
|
+
</section>
|
69
|
+
<% end %>
|
70
|
+
<% unless @person.identifiers.empty? %>
|
71
|
+
<section>
|
72
|
+
<header>
|
73
|
+
<h2><%= Popolo::Identifier.model_name.human(count: @person.identifiers.size) %></h2>
|
74
|
+
</header>
|
75
|
+
<dl class="dl-horizontal">
|
76
|
+
<%= render @person.identifiers %>
|
77
|
+
</dl>
|
78
|
+
</section>
|
79
|
+
<% end %>
|
80
|
+
<% unless @person.links.empty? %>
|
81
|
+
<section>
|
82
|
+
<header>
|
83
|
+
<h2><%= Popolo::Link.model_name.human(count: @person.links.size) %></h2>
|
84
|
+
</header>
|
85
|
+
<ul>
|
86
|
+
<%= render @person.links %>
|
87
|
+
</ul>
|
88
|
+
</section>
|
89
|
+
<% end %>
|
90
|
+
<% unless @person.sources.empty? %>
|
91
|
+
<section>
|
92
|
+
<header>
|
93
|
+
<h2><%=t 'popolo/source', count: @person.sources.size, scope: [:popolo] %></h2>
|
94
|
+
</header>
|
95
|
+
<ul>
|
96
|
+
<%= render @person.sources %>
|
97
|
+
</ul>
|
98
|
+
</section>
|
99
|
+
<% end %>
|
100
|
+
</aside>
|
101
|
+
|
102
|
+
<aside>
|
103
|
+
<% unless @person.memberships.empty? %>
|
104
|
+
<section>
|
105
|
+
<header>
|
106
|
+
<h2>
|
107
|
+
<%= Popolo::Membership.model_name.human(count: @person.memberships.size) %>
|
108
|
+
</h2>
|
109
|
+
</header>
|
110
|
+
<ol>
|
111
|
+
<% @person.memberships.each do |membership| %>
|
112
|
+
<li>
|
113
|
+
<%= link_to membership.to_s(format: :organization), membership %>
|
114
|
+
</li>
|
115
|
+
<% end %>
|
116
|
+
</ol>
|
117
|
+
</section>
|
118
|
+
<% end %>
|
119
|
+
</aside>
|
120
|
+
</section>
|
@@ -0,0 +1,90 @@
|
|
1
|
+
<nav>
|
2
|
+
<ol class="breadcrumb">
|
3
|
+
<li><%= link_to Popolo::Organization.model_name.human(count: Float::INFINITY), organizations_path %></li>
|
4
|
+
<% @post.organization.ancestors_and_self.each do |ancestor| %>
|
5
|
+
<li><%= link_to ancestor, ancestor %></li>
|
6
|
+
<% end %>
|
7
|
+
<li class="active"><%= @post %></li>
|
8
|
+
</ol>
|
9
|
+
</nav>
|
10
|
+
|
11
|
+
<section>
|
12
|
+
<header class="page-header">
|
13
|
+
<div class="media">
|
14
|
+
<div class="media-body">
|
15
|
+
<h1 class="media-heading">
|
16
|
+
<%= @post %>
|
17
|
+
</h1>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</header>
|
21
|
+
|
22
|
+
<dl>
|
23
|
+
<dt><%= Popolo::Post.human_attribute_name(:organization) %></dt>
|
24
|
+
<dd><%= link_to @post.organization, @post.organization %></dd>
|
25
|
+
<% if @post.role? %>
|
26
|
+
<dt><%= Popolo::Post.human_attribute_name(:role) %></dt>
|
27
|
+
<dd><%= @post.role %></dd>
|
28
|
+
<% end %>
|
29
|
+
<% if @post.start_date? %>
|
30
|
+
<dt><%= Popolo::Post.human_attribute_name(:start_date) %></dt>
|
31
|
+
<dd><%=l @post.start_date %></dd>
|
32
|
+
<% end %>
|
33
|
+
<% if @post.end_date? %>
|
34
|
+
<dt><%= Popolo::Post.human_attribute_name(:end_date) %></dt>
|
35
|
+
<dd><%=l @post.end_date %></dd>
|
36
|
+
<% end %>
|
37
|
+
</dl>
|
38
|
+
|
39
|
+
<aside>
|
40
|
+
<% unless @post.contact_details.empty? %>
|
41
|
+
<section>
|
42
|
+
<header>
|
43
|
+
<h2><%= Popolo::ContactDetail.model_name.human(count: @post.contact_details.size) %></h2>
|
44
|
+
</header>
|
45
|
+
<dl class="dl-horizontal">
|
46
|
+
<%= render @post.contact_details %>
|
47
|
+
</dl>
|
48
|
+
</section>
|
49
|
+
<% end %>
|
50
|
+
<% unless @post.links.empty? %>
|
51
|
+
<section>
|
52
|
+
<header>
|
53
|
+
<h2><%= Popolo::Link.model_name.human(count: @post.links.size) %></h2>
|
54
|
+
</header>
|
55
|
+
<ul>
|
56
|
+
<%= render @post.links %>
|
57
|
+
</ul>
|
58
|
+
</section>
|
59
|
+
<% end %>
|
60
|
+
<% unless @post.sources.empty? %>
|
61
|
+
<section>
|
62
|
+
<header>
|
63
|
+
<h2><%=t 'popolo/source', count: @post.sources.size, scope: [:popolo] %></h2>
|
64
|
+
</header>
|
65
|
+
<ul>
|
66
|
+
<%= render @post.sources %>
|
67
|
+
</ul>
|
68
|
+
</section>
|
69
|
+
<% end %>
|
70
|
+
</aside>
|
71
|
+
|
72
|
+
<aside>
|
73
|
+
<% unless @post.memberships.empty? %>
|
74
|
+
<section>
|
75
|
+
<header>
|
76
|
+
<h2>
|
77
|
+
<%= Popolo::Membership.model_name.human(count: @post.memberships.size) %>
|
78
|
+
</h2>
|
79
|
+
</header>
|
80
|
+
<ol>
|
81
|
+
<% @post.memberships.each do |membership| %>
|
82
|
+
<li>
|
83
|
+
<%= link_to membership, membership %>
|
84
|
+
</li>
|
85
|
+
<% end %>
|
86
|
+
</ol>
|
87
|
+
</section>
|
88
|
+
<% end %>
|
89
|
+
</aside>
|
90
|
+
</section>
|
data/config/routes.rb
CHANGED
@@ -1,16 +1,8 @@
|
|
1
1
|
Popolo::Engine.routes.draw do
|
2
|
-
resources :
|
3
|
-
resources :
|
4
|
-
resources :people, only:
|
5
|
-
resources :posts, only:
|
6
|
-
|
7
|
-
match 'areas/*path/areas' => 'areas#nested_index', as: 'nested_areas'
|
8
|
-
match 'areas/*path' => 'areas#nested_show', as: 'nested_area'
|
9
|
-
|
10
|
-
match 'organizations/*path/organizations' => 'organizations#nested_index', as: 'nested_organizations'
|
11
|
-
match 'organizations/*path/posts/:id' => 'organizations#post', as: 'nested_organization_post'
|
12
|
-
match 'organizations/*path/posts' => 'organizations#posts', as: 'nested_organization_posts'
|
13
|
-
match 'organizations/*path' => 'organizations#nested_show', as: 'nested_organization'
|
2
|
+
resources :organizations, only: [:index, :show], id: /.*/
|
3
|
+
resources :memberships, only: :show, id: /.*/
|
4
|
+
resources :people, only: :show, id: /.*/
|
5
|
+
resources :posts, only: :show, id: /.*/
|
14
6
|
|
15
7
|
# A host application will sometimes complain about a missing `root_path`, even
|
16
8
|
# if it defines a `root_path`. Setting a reasonable default here.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# @see https://github.com/mongoid/mongoid/blob/master/lib/mongoid/factory.rb#L39
|
2
|
+
module Mongoid
|
3
|
+
module Factory
|
4
|
+
old_from_db = instance_method(:from_db)
|
5
|
+
|
6
|
+
define_method(:from_db) do |klass, attributes=nil, criteria_instance_id=nil|
|
7
|
+
attributes.delete('_type') if attributes && klass.name.deconstantize == 'Popolo'
|
8
|
+
old_from_db.bind(self).call(klass, attributes, criteria_instance_id)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/popolo/version.rb
CHANGED
data/lib/popolo.rb
CHANGED
@@ -6,13 +6,25 @@ require 'mongoid'
|
|
6
6
|
require 'mongoid/tree'
|
7
7
|
|
8
8
|
module Popolo
|
9
|
-
# The parent controller all Popolo controllers
|
10
|
-
#
|
11
|
-
#
|
9
|
+
# The parent controller all Popolo controllers inherit from. Defaults to
|
10
|
+
# ApplicationController. This should be set early in the initialization
|
11
|
+
# process and should be set to a string.
|
12
12
|
#
|
13
13
|
# @see https://github.com/plataformatec/devise/blob/master/lib/devise.rb#L196
|
14
14
|
mattr_accessor :parent_controller
|
15
15
|
@@parent_controller = 'ApplicationController'
|
16
|
-
end
|
17
16
|
|
18
|
-
|
17
|
+
# The database and session storage options used by all Popolo models.
|
18
|
+
#
|
19
|
+
# @see http://mongoid.org/en/mongoid/docs/documents.html#storage
|
20
|
+
mattr_accessor :storage_options
|
21
|
+
@@storage_options = {}
|
22
|
+
|
23
|
+
# The storage options for each Popolo model.
|
24
|
+
#
|
25
|
+
# @see http://mongoid.org/en/mongoid/docs/documents.html#storage
|
26
|
+
mattr_accessor :storage_options_per_class
|
27
|
+
@@storage_options_per_class = {}
|
28
|
+
|
29
|
+
DATE_STRING_FORMAT = /\A\d{4}(-\d{2}){0,2}\z/
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Popolo::MembershipsController do
|
4
|
+
before :each do
|
5
|
+
@routes = Popolo::Engine.routes
|
6
|
+
@membership = FactoryGirl.create :membership
|
7
|
+
end
|
8
|
+
|
9
|
+
describe 'GET show' do
|
10
|
+
it 'assigns the requested membership as @membership' do
|
11
|
+
get :show, id: @membership.id.to_s
|
12
|
+
assigns(:membership).should == @membership
|
13
|
+
response.should be_success
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -1,15 +1,9 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
require 'spec_helper'
|
3
2
|
|
4
3
|
describe Popolo::OrganizationsController do
|
5
4
|
before :each do
|
6
5
|
@routes = Popolo::Engine.routes
|
7
|
-
@organization = FactoryGirl.create :organization
|
8
|
-
@abc = @organization.children.create name: 'ABC, Inc.'
|
9
|
-
@xyz = @organization.children.create name: 'XYZ, Inc.'
|
10
|
-
@department = @xyz.children.create name: "Marketing Department"
|
11
|
-
@branch = @department.children.create name: "Youth Branch"
|
12
|
-
@post = FactoryGirl.create :post, organization: @xyz
|
6
|
+
@organization = FactoryGirl.create :organization
|
13
7
|
end
|
14
8
|
|
15
9
|
describe 'GET index' do
|
@@ -27,44 +21,4 @@ describe Popolo::OrganizationsController do
|
|
27
21
|
response.should be_success
|
28
22
|
end
|
29
23
|
end
|
30
|
-
|
31
|
-
describe 'GET nested_index' do
|
32
|
-
it 'succeeds if properly nested' do
|
33
|
-
get :nested_index, path: 'acme-corporation/xyz-inc/marketing-department'
|
34
|
-
assigns(:organizations).to_a.should == [@branch]
|
35
|
-
response.should be_success
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'fails if improperly nested' do
|
39
|
-
expect {get :nested_index, path: 'acme-corporation/abc-inc/marketing-department'}.to raise_error(Mongoid::Errors::DocumentNotFound)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
describe 'GET nested_show' do
|
44
|
-
it 'succeeds if properly nested' do
|
45
|
-
get :nested_show, path: 'acme-corporation/xyz-inc/marketing-department'
|
46
|
-
assigns(:organization).should == @department
|
47
|
-
response.should be_success
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'fails if improperly nested' do
|
51
|
-
expect {get :nested_show, path: 'acme-corporation/abc-inc/marketing-department'}.to raise_error(Mongoid::Errors::DocumentNotFound)
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe 'GET posts' do
|
56
|
-
it 'assigns the requested posts as @posts' do
|
57
|
-
get :posts, path: 'acme-corporation/xyz-inc'
|
58
|
-
assigns(:posts).to_a.should == [@post]
|
59
|
-
response.should be_success
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe 'GET post' do
|
64
|
-
it 'assigns the requested post as @post' do
|
65
|
-
get :post, path: 'acme-corporation/xyz-inc', id: 'marketing-director'
|
66
|
-
assigns(:post).should == @post
|
67
|
-
response.should be_success
|
68
|
-
end
|
69
|
-
end
|
70
24
|
end
|
@@ -6,25 +6,11 @@ describe Popolo::PeopleController do
|
|
6
6
|
@person = FactoryGirl.create :person
|
7
7
|
end
|
8
8
|
|
9
|
-
describe 'GET index' do
|
10
|
-
it 'assigns all people as @people' do
|
11
|
-
get :index
|
12
|
-
assigns(:people).to_a.should == [@person]
|
13
|
-
response.should be_success
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
9
|
describe 'GET show' do
|
18
10
|
it 'assigns the requested person as @person' do
|
19
11
|
get :show, id: @person.id.to_s
|
20
12
|
assigns(:person).should == @person
|
21
13
|
response.should be_success
|
22
14
|
end
|
23
|
-
|
24
|
-
it 'gets the requested person by slug' do
|
25
|
-
get :show, id: @person.slug
|
26
|
-
assigns(:person).should == @person
|
27
|
-
response.should be_success
|
28
|
-
end
|
29
15
|
end
|
30
16
|
end
|
@@ -6,14 +6,6 @@ describe Popolo::PostsController do
|
|
6
6
|
@post = FactoryGirl.create :post
|
7
7
|
end
|
8
8
|
|
9
|
-
describe 'GET index' do
|
10
|
-
it 'assigns all posts as @posts' do
|
11
|
-
get :index
|
12
|
-
assigns(:posts).to_a.should == [@post]
|
13
|
-
response.should be_success
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
9
|
describe 'GET show' do
|
18
10
|
it 'assigns the requested post as @post' do
|
19
11
|
get :show, id: @post.id.to_s
|
@@ -3,3 +3,33 @@
|
|
3
3
|
|
4
4
|
en:
|
5
5
|
hello: "Hello world"
|
6
|
+
mongoid:
|
7
|
+
models:
|
8
|
+
popolo/contact_detail:
|
9
|
+
one: Contact detail
|
10
|
+
other: Contact details
|
11
|
+
popolo/identifier:
|
12
|
+
one: Identifier
|
13
|
+
other: Identifiers
|
14
|
+
popolo/link:
|
15
|
+
one: Link
|
16
|
+
other: Links
|
17
|
+
popolo/membership:
|
18
|
+
one: Membership
|
19
|
+
other: Memberships
|
20
|
+
popolo/organization:
|
21
|
+
one: Organization
|
22
|
+
other: Organizations
|
23
|
+
popolo/other_name:
|
24
|
+
one: Other name
|
25
|
+
other: Other names
|
26
|
+
popolo/person:
|
27
|
+
one: Person
|
28
|
+
other: People
|
29
|
+
popolo/post:
|
30
|
+
one: Post
|
31
|
+
other: Posts
|
32
|
+
popolo:
|
33
|
+
popolo/source:
|
34
|
+
one: Source
|
35
|
+
other: Sources
|
data/spec/dummy/config/routes.rb
CHANGED