23 |
23 |
|
24 |
24 |
module Loader
|
25 |
25 |
include Redmine::I18n
|
26 |
|
|
27 |
26 |
class << self
|
28 |
27 |
# Returns true if no data is already loaded in the database
|
29 |
28 |
# otherwise false
|
... | ... | |
31 |
30 |
!Role.where(:builtin => 0).exists? &&
|
32 |
31 |
!Tracker.exists? &&
|
33 |
32 |
!IssueStatus.exists? &&
|
34 |
|
!Enumeration.exists?
|
|
33 |
!Enumeration.exists? &&
|
|
34 |
!IssueQuery.exists?
|
35 |
35 |
end
|
36 |
36 |
|
37 |
37 |
# Loads the default data
|
... | ... | |
191 |
191 |
|
192 |
192 |
TimeEntryActivity.create!(:name => l(:default_activity_design), :position => 1)
|
193 |
193 |
TimeEntryActivity.create!(:name => l(:default_activity_development), :position => 2)
|
|
194 |
|
|
195 |
# Queries
|
|
196 |
IssueQuery.create!(
|
|
197 |
:name => l(:label_assigned_to_me_issues),
|
|
198 |
:filters =>
|
|
199 |
{
|
|
200 |
'status_id' => {:operator => 'o', :values => ['']},
|
|
201 |
'assigned_to_id' => {:operator => '=', :values => ['me']},
|
|
202 |
'project.status' => {:operator => '=', :values => ['1']}
|
|
203 |
},
|
|
204 |
:sort_criteria => [['priority', 'desc'], ['updated_on', 'desc']],
|
|
205 |
:visibility => Query::VISIBILITY_PUBLIC
|
|
206 |
)
|
|
207 |
IssueQuery.create!(
|
|
208 |
:name => l(:label_reported_issues),
|
|
209 |
:filters =>
|
|
210 |
{
|
|
211 |
'status_id' => {:operator => 'o', :values => ['']},
|
|
212 |
'author_id' => {:operator => '=', :values => ['me']},
|
|
213 |
'project.status' => {:operator => '=', :values => ['1']}
|
|
214 |
},
|
|
215 |
:sort_criteria => [['updated_on', 'desc']],
|
|
216 |
:visibility => Query::VISIBILITY_PUBLIC
|
|
217 |
)
|
|
218 |
IssueQuery.create!(
|
|
219 |
:name => l(:label_updated_issues),
|
|
220 |
:filters =>
|
|
221 |
{
|
|
222 |
'status_id' => {:operator => 'o', :values => ['']},
|
|
223 |
'updated_by' => {:operator => '=', :values => ['me']},
|
|
224 |
'project.status' => {:operator => '=', :values => ['1']}
|
|
225 |
},
|
|
226 |
:sort_criteria => [['updated_on', 'desc']],
|
|
227 |
:visibility => Query::VISIBILITY_PUBLIC
|
|
228 |
)
|
|
229 |
IssueQuery.create!(
|
|
230 |
:name => l(:label_watched_issues),
|
|
231 |
:filters =>
|
|
232 |
{
|
|
233 |
'status_id' => {:operator => 'o', :values => ['']},
|
|
234 |
'watcher_id' => {:operator => '=', :values => ['me']},
|
|
235 |
'project.status' => {:operator => '=', :values => ['1']},
|
|
236 |
},
|
|
237 |
:sort_criteria => [['updated_on', 'desc']],
|
|
238 |
:visibility => Query::VISIBILITY_PUBLIC
|
|
239 |
)
|
|
240 |
|
|
241 |
ProjectQuery.create!(
|
|
242 |
:name => l(:label_my_projects),
|
|
243 |
:filters =>
|
|
244 |
{
|
|
245 |
"status" => {:operator => "=", :values => ["1"]},
|
|
246 |
"id" => {:operator=>"=", :values=>["mine"]}
|
|
247 |
},
|
|
248 |
:visibility => Query::VISIBILITY_PUBLIC
|
|
249 |
)
|
|
250 |
ProjectQuery.create!(
|
|
251 |
:name => l(:label_my_bookmarks),
|
|
252 |
:filters =>
|
|
253 |
{
|
|
254 |
"status" => {:operator => "=", :values => ["1"]},
|
|
255 |
"id" => {:operator=>"=", :values=>["bookmarks"]}
|
|
256 |
},
|
|
257 |
:visibility => Query::VISIBILITY_PUBLIC
|
|
258 |
)
|
194 |
259 |
end
|
195 |
260 |
true
|
196 |
261 |
end
|