talia_core 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +4 -0
- data/config/database.yml +19 -0
- data/config/database.yml.example +35 -0
- data/config/rdfstore.yml +13 -0
- data/config/rdfstore.yml.example +13 -0
- data/config/rdfstore.yml.rdflite_example +16 -0
- data/config/rdfstore.yml.redland_example +46 -0
- data/config/talia_core.yml +14 -0
- data/config/talia_core.yml.example +42 -0
- data/generators/generator_helpers.rb +49 -0
- data/generators/talia_admin/USAGE +1 -0
- data/generators/talia_admin/talia_admin_generator.rb +19 -0
- data/generators/talia_admin/templates/controllers/admin/background_controller.rb +50 -0
- data/generators/talia_admin/templates/controllers/admin/custom_templates_controller.rb +25 -0
- data/generators/talia_admin/templates/controllers/admin/locales_controller.rb +15 -0
- data/generators/talia_admin/templates/controllers/admin/sources_controller.rb +71 -0
- data/generators/talia_admin/templates/controllers/admin/translations_controller.rb +61 -0
- data/generators/talia_admin/templates/controllers/admin/users_controller.rb +48 -0
- data/generators/talia_admin/templates/controllers/admin_controller.rb +7 -0
- data/generators/talia_admin/templates/helpers/admin/background_helper.rb +60 -0
- data/generators/talia_admin/templates/helpers/admin/custom_templates_helper.rb +5 -0
- data/generators/talia_admin/templates/helpers/admin/locales_helper.rb +2 -0
- data/generators/talia_admin/templates/helpers/admin/sources_helper.rb +65 -0
- data/generators/talia_admin/templates/helpers/admin/translations_helper.rb +51 -0
- data/generators/talia_admin/templates/helpers/admin/users_helper.rb +2 -0
- data/generators/talia_admin/templates/helpers/admin_helper.rb +11 -0
- data/generators/talia_admin/templates/public/images/backend/body_bg.gif +0 -0
- data/generators/talia_admin/templates/public/images/backend/footer_bg.gif +0 -0
- data/generators/talia_admin/templates/public/images/backend/header.jpg +0 -0
- data/generators/talia_admin/templates/public/images/backend/header_bg.gif +0 -0
- data/generators/talia_admin/templates/public/images/backend/menu.jpg +0 -0
- data/generators/talia_admin/templates/public/images/backend/menu_bg.gif +0 -0
- data/generators/talia_admin/templates/public/images/backend/opednid.gif +0 -0
- data/generators/talia_admin/templates/public/images/backend/page_bg.jpg +0 -0
- data/generators/talia_admin/templates/public/images/backend/triangolino.gif +0 -0
- data/generators/talia_admin/templates/public/images/backend/triangolino_full.gif +0 -0
- data/generators/talia_admin/templates/public/javascripts/backend.js +24 -0
- data/generators/talia_admin/templates/public/javascripts/lowpro.js +321 -0
- data/generators/talia_admin/templates/public/stylesheets/backend.css +466 -0
- data/generators/talia_admin/templates/test/fixtures/users.yml +32 -0
- data/generators/talia_admin/templates/test/functional/admin/custom_templates_controller_test.rb +8 -0
- data/generators/talia_admin/templates/test/functional/admin/locales_controller_test.rb +35 -0
- data/generators/talia_admin/templates/test/functional/admin/sources_controller_test.rb +109 -0
- data/generators/talia_admin/templates/test/functional/admin/translations_controller_test.rb +93 -0
- data/generators/talia_admin/templates/test/functional/admin/users_controller_test.rb +67 -0
- data/generators/talia_admin/templates/test/functional/admin_controller_test.rb +15 -0
- data/generators/talia_admin/templates/test/unit/user_test.rb +134 -0
- data/generators/talia_admin/templates/views/admin/background/_finished.html.erb +9 -0
- data/generators/talia_admin/templates/views/admin/background/_pending.html.erb +1 -0
- data/generators/talia_admin/templates/views/admin/background/_progress.html.erb +15 -0
- data/generators/talia_admin/templates/views/admin/background/_running.html.erb +11 -0
- data/generators/talia_admin/templates/views/admin/background/environment.html.erb +12 -0
- data/generators/talia_admin/templates/views/admin/background/show.html.erb +17 -0
- data/generators/talia_admin/templates/views/admin/background/stderr.html.erb +6 -0
- data/generators/talia_admin/templates/views/admin/background/stdin.html.erb +6 -0
- data/generators/talia_admin/templates/views/admin/background/stdout.html.erb +6 -0
- data/generators/talia_admin/templates/views/admin/custom_templates/_content_form_column.rhtml +2 -0
- data/generators/talia_admin/templates/views/admin/custom_templates/_template_type_form_column.rhtml +2 -0
- data/generators/talia_admin/templates/views/admin/index.html.erb +5 -0
- data/generators/talia_admin/templates/views/admin/locales/new.html.erb +9 -0
- data/generators/talia_admin/templates/views/admin/sources/_data.html.erb +6 -0
- data/generators/talia_admin/templates/views/admin/sources/_data_form.html.erb +15 -0
- data/generators/talia_admin/templates/views/admin/sources/_form.html.erb +7 -0
- data/generators/talia_admin/templates/views/admin/sources/_list.html.erb +3 -0
- data/generators/talia_admin/templates/views/admin/sources/_notice.html.erb +1 -0
- data/generators/talia_admin/templates/views/admin/sources/_predicate.html.erb +22 -0
- data/generators/talia_admin/templates/views/admin/sources/_predicates.html.erb +15 -0
- data/generators/talia_admin/templates/views/admin/sources/_sources.html.erb +17 -0
- data/generators/talia_admin/templates/views/admin/sources/_upload.html.erb +6 -0
- data/generators/talia_admin/templates/views/admin/sources/edit.html.erb +6 -0
- data/generators/talia_admin/templates/views/admin/sources/index.html.erb +5 -0
- data/generators/talia_admin/templates/views/admin/translations/_new_translation.html.erb +7 -0
- data/generators/talia_admin/templates/views/admin/translations/_translation.html.erb +10 -0
- data/generators/talia_admin/templates/views/admin/translations/edit.html.erb +16 -0
- data/generators/talia_admin/templates/views/admin/users/_form.html.erb +10 -0
- data/generators/talia_admin/templates/views/admin/users/_form_roles.html.erb +8 -0
- data/generators/talia_admin/templates/views/admin/users/edit.html.erb +12 -0
- data/generators/talia_admin/templates/views/admin/users/index.html.erb +22 -0
- data/generators/talia_admin/templates/views/admin/users/new.html.erb +5 -0
- data/generators/talia_admin/templates/views/admin/users/show.html.erb +6 -0
- data/generators/talia_admin/templates/views/layouts/admin.html.erb +56 -0
- data/generators/talia_base/USAGE +5 -0
- data/generators/talia_base/talia_base_generator.rb +62 -0
- data/generators/talia_base/templates/app/controllers/custom_templates_controller.rb +27 -0
- data/generators/talia_base/templates/app/controllers/ontologies_controller.rb +13 -0
- data/generators/talia_base/templates/app/controllers/sessions_controller.rb +90 -0
- data/generators/talia_base/templates/app/controllers/source_data/show.html.erb +2 -0
- data/generators/talia_base/templates/app/controllers/source_data_controller.rb +43 -0
- data/generators/talia_base/templates/app/controllers/sources_controller.rb +62 -0
- data/generators/talia_base/templates/app/controllers/types_controller.rb +23 -0
- data/generators/talia_base/templates/app/helpers/custom_templates_helper.rb +2 -0
- data/generators/talia_base/templates/app/helpers/ontologies_helper.rb +2 -0
- data/generators/talia_base/templates/app/helpers/sessions_helper.rb +2 -0
- data/generators/talia_base/templates/app/helpers/source_data/show.html.erb +2 -0
- data/generators/talia_base/templates/app/helpers/source_data_helper.rb +2 -0
- data/generators/talia_base/templates/app/helpers/sources_helper.rb +39 -0
- data/generators/talia_base/templates/app/helpers/types_helper.rb +2 -0
- data/generators/talia_base/templates/app/views/ontologies/index.builder +10 -0
- data/generators/talia_base/templates/app/views/ontologies/show.builder +7 -0
- data/generators/talia_base/templates/app/views/sessions/new.html.erb +33 -0
- data/generators/talia_base/templates/app/views/source_data/show.html.erb +2 -0
- data/generators/talia_base/templates/app/views/sources/_form.html.erb +15 -0
- data/generators/talia_base/templates/app/views/sources/edit.html.erb +9 -0
- data/generators/talia_base/templates/app/views/sources/index.html.erb +2 -0
- data/generators/talia_base/templates/app/views/sources/new.html.erb +8 -0
- data/generators/talia_base/templates/app/views/sources/show.html.erb +19 -0
- data/generators/talia_base/templates/app/views/types/index.html.erb +4 -0
- data/generators/talia_base/templates/app/views/types/show.html.erb +3 -0
- data/generators/talia_base/templates/config/routes.rb +83 -0
- data/generators/talia_base/templates/config/talia_initializer.rb +8 -0
- data/generators/talia_base/templates/migrations/bj_migration.rb +10 -0
- data/generators/talia_base/templates/migrations/constraint_migration.rb +24 -0
- data/generators/talia_base/templates/migrations/create_active_sources.rb +15 -0
- data/generators/talia_base/templates/migrations/create_custom_templates.rb +17 -0
- data/generators/talia_base/templates/migrations/create_data_records.rb +27 -0
- data/generators/talia_base/templates/migrations/create_open_id.rb +26 -0
- data/generators/talia_base/templates/migrations/create_progress_jobs.rb +18 -0
- data/generators/talia_base/templates/migrations/create_roles.rb +20 -0
- data/generators/talia_base/templates/migrations/create_semantic_properties.rb +14 -0
- data/generators/talia_base/templates/migrations/create_semantic_relations.rb +17 -0
- data/generators/talia_base/templates/migrations/create_sessions.rb +16 -0
- data/generators/talia_base/templates/migrations/create_users.rb +20 -0
- data/generators/talia_base/templates/migrations/create_workflows.rb +28 -0
- data/generators/talia_base/templates/migrations/populate_users.rb +11 -0
- data/generators/talia_base/templates/migrations/upgrade_relations.rb +12 -0
- data/generators/talia_base/templates/ontologies/hyper_ontology.owl +1462 -0
- data/generators/talia_base/templates/ontologies/hyper_ontology.pprj +9351 -0
- data/generators/talia_base/templates/ontologies/hyper_ontology.repository +6 -0
- data/generators/talia_base/templates/ontologies/scholar_0.1.owl +109 -0
- data/generators/talia_base/templates/script/configure_talia +292 -0
- data/generators/talia_base/templates/script/prepare_images +100 -0
- data/generators/talia_base/templates/talia.sh +51 -0
- data/generators/talia_base/templates/tasks/talia_core.rk +1 -0
- data/lib/loader_helper.rb +9 -0
- data/lib/talia_core.rb +0 -2
- data/lib/talia_dependencies.rb +5 -0
- data/lib/talia_util/rake_tasks.rb +223 -0
- data/tasks/talia_core_tasks.rake +2 -0
- metadata +138 -13
@@ -0,0 +1,93 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
|
3
|
+
class Admin::TranslationsControllerTest < ActionController::TestCase
|
4
|
+
def test_should_redirect_to_active_locale_edit
|
5
|
+
login_as :admin
|
6
|
+
get :index
|
7
|
+
assert_redirected_to edit_admin_translation_path(Locale.active.code)
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_should_get_edit_page
|
11
|
+
login_as :admin
|
12
|
+
get :edit, :id => locale
|
13
|
+
assert_response :success
|
14
|
+
assert_layout :admin
|
15
|
+
|
16
|
+
assert_select "#languages_picker", /^Pick a language:/
|
17
|
+
assert_select "#languages_picker", /Add a translation/
|
18
|
+
assert_select "#languages_picker", /Add locale/
|
19
|
+
assert_select "#languages_picker" do
|
20
|
+
assert_select "select"
|
21
|
+
end
|
22
|
+
|
23
|
+
assert_select 'form' do
|
24
|
+
assert_select '[action=?]', "/admin/translations/#{locale}"
|
25
|
+
assert_select 'input[type=?]', 'hidden'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# TODO move this case in a integration test.
|
30
|
+
def test_translations_autoload
|
31
|
+
login_as :admin
|
32
|
+
reference_locale = 'it-IT'
|
33
|
+
|
34
|
+
# Case 1: visit /admin/translations
|
35
|
+
get :index
|
36
|
+
assert_redirected_to edit_admin_translation_path(Locale.active.code)
|
37
|
+
assert_nil session[:reference_locale]
|
38
|
+
assert_false assigns(:autoload)
|
39
|
+
|
40
|
+
# Case 2: manually load reference translations
|
41
|
+
get :search, { :locale => reference_locale, :key1 => "hello" }
|
42
|
+
assert_response :success
|
43
|
+
assert_equal reference_locale, session[:reference_locale]
|
44
|
+
|
45
|
+
# Case 3: go to next page and get reference translations autoloaded
|
46
|
+
get :edit, { :id => Locale.active.code, :page => 2 }
|
47
|
+
assert_response :success
|
48
|
+
assert_equal reference_locale, session[:reference_locale]
|
49
|
+
assert assigns(:autoload)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_should_update_translations
|
53
|
+
orig_magick = Locale.active.magick
|
54
|
+
login_as :admin
|
55
|
+
put :update, params
|
56
|
+
# assert_flash_notice "Your translations has been saved"
|
57
|
+
assert_redirected_to edit_admin_translation_path(locale)
|
58
|
+
assert_equal(session[:glob_cache], Locale.active.magick)
|
59
|
+
assert(Locale.active.magick && (Locale.active.magick != orig_magick))
|
60
|
+
end
|
61
|
+
|
62
|
+
uses_mocha 'Admin::TranslationsControllerTest' do
|
63
|
+
def test_should_show_error_message_on_failing_update
|
64
|
+
ViewTranslation.expects(:update).returns false
|
65
|
+
login_as :admin
|
66
|
+
put :update, params
|
67
|
+
# assert_flash_error "There was some problems"
|
68
|
+
assert_redirected_to edit_admin_translation_path(locale, {:page => 2})
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_should_destroy_translation
|
73
|
+
login_as :admin
|
74
|
+
delete :destroy, :id => 1, :locale => 'en-US', :page => "1"
|
75
|
+
assert_raise(ActiveRecord::RecordNotFound) { ViewTranslation.find(1) }
|
76
|
+
# assert_flash_notice "Your translation has been deleted"
|
77
|
+
assert_redirected_to edit_admin_translation_path(locale)
|
78
|
+
end
|
79
|
+
|
80
|
+
private
|
81
|
+
def locale
|
82
|
+
'en-US'
|
83
|
+
end
|
84
|
+
|
85
|
+
def translations
|
86
|
+
[ { "id" => "1", "tr_key" => "hello", "text" => "Hello!" },
|
87
|
+
{ "id" => "", "tr_key" => "rabbit", "text" => "Rabbit" } ]
|
88
|
+
end
|
89
|
+
|
90
|
+
def params
|
91
|
+
{ "id" => locale, "page" => "2", "translations" => translations }
|
92
|
+
end
|
93
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../test_helper'
|
2
|
+
|
3
|
+
class Admin::UsersControllerTest < ActionController::TestCase
|
4
|
+
# TODO: DRY tests. Check why login_as :admin doesn't work if inside #setup.
|
5
|
+
|
6
|
+
def test_should_get_index
|
7
|
+
login_as :admin
|
8
|
+
|
9
|
+
get :index
|
10
|
+
assert_response :success
|
11
|
+
assert_not_nil assigns(:users)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_should_get_new
|
15
|
+
login_as :admin
|
16
|
+
|
17
|
+
get :new
|
18
|
+
assert_response :success
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_should_create_user
|
22
|
+
login_as :admin
|
23
|
+
|
24
|
+
assert_difference('User.count') do
|
25
|
+
post :create, :user => params
|
26
|
+
end
|
27
|
+
|
28
|
+
assert_redirected_to :action => "show", :id => assigns(:user)
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_should_show_user
|
32
|
+
login_as :admin
|
33
|
+
|
34
|
+
get :show, :id => users(:quentin).id
|
35
|
+
assert_response :success
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_should_get_edit
|
39
|
+
login_as :admin
|
40
|
+
|
41
|
+
get :edit, :id => users(:quentin).id
|
42
|
+
assert_response :success
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_should_update_user
|
46
|
+
login_as :admin
|
47
|
+
|
48
|
+
put :update, :id => users(:someone).id, :user => params
|
49
|
+
assert_redirected_to :action => "show", :id => assigns(:user)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_should_destroy_user
|
53
|
+
login_as :admin
|
54
|
+
|
55
|
+
assert_difference('User.count', -1) do
|
56
|
+
delete :destroy, :id => Fixtures.identify(:someone)
|
57
|
+
end
|
58
|
+
|
59
|
+
assert_redirected_to :action => "index"
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
def params
|
64
|
+
{ :login => 'luca', :email => 'luca@talia.org',
|
65
|
+
:password => 'luca', :password_confirmation => 'luca' }
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
|
3
|
+
class AdminControllerTest < ActionController::TestCase
|
4
|
+
def test_should_redirect_to_login_when_not_loggedin
|
5
|
+
get :index
|
6
|
+
assert_redirected_to login_path
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_should_get_index_when_loggedin_as_admin
|
10
|
+
login_as :admin
|
11
|
+
|
12
|
+
get :index
|
13
|
+
assert_response :success
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
2
|
+
|
3
|
+
class UserTest < Test::Unit::TestCase
|
4
|
+
# Be sure to include AuthenticatedTestHelper in test/test_helper.rb instead.
|
5
|
+
# Then, you can remove it from this and the functional test.
|
6
|
+
include AuthenticatedTestHelper
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@open_id = 'http://quentin.someopenidprovider.com'
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_should_create_user
|
13
|
+
assert_difference 'User.count' do
|
14
|
+
user = create_user
|
15
|
+
assert !user.new_record?, "#{user.errors.full_messages.to_sentence}"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_should_require_login
|
20
|
+
assert_no_difference 'User.count' do
|
21
|
+
u = create_user(:login => nil)
|
22
|
+
assert u.errors.on(:login)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_should_require_password
|
27
|
+
assert_no_difference 'User.count' do
|
28
|
+
u = create_user(:password => nil)
|
29
|
+
assert u.errors.on(:password)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_should_require_password_confirmation
|
34
|
+
assert_no_difference 'User.count' do
|
35
|
+
u = create_user(:password_confirmation => nil)
|
36
|
+
assert u.errors.on(:password_confirmation)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_should_require_email
|
41
|
+
assert_no_difference 'User.count' do
|
42
|
+
u = create_user(:email => nil)
|
43
|
+
assert u.errors.on(:email)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_should_reset_password
|
48
|
+
users(:quentin).update_attributes(:password => 'new password', :password_confirmation => 'new password')
|
49
|
+
assert_equal users(:quentin), User.authenticate('quentin', 'new password')
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_should_not_rehash_password
|
53
|
+
users(:quentin).update_attributes(:login => 'quentin2')
|
54
|
+
assert_equal users(:quentin), User.authenticate('quentin2', 'test')
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_should_authenticate_user
|
58
|
+
assert_equal users(:quentin), User.authenticate('quentin', 'test')
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_should_set_remember_token
|
62
|
+
users(:quentin).remember_me
|
63
|
+
assert_not_nil users(:quentin).remember_token
|
64
|
+
assert_not_nil users(:quentin).remember_token_expires_at
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_should_unset_remember_token
|
68
|
+
users(:quentin).remember_me
|
69
|
+
assert_not_nil users(:quentin).remember_token
|
70
|
+
users(:quentin).forget_me
|
71
|
+
assert_nil users(:quentin).remember_token
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_should_remember_me_for_one_week
|
75
|
+
before = 1.week.from_now.utc
|
76
|
+
users(:quentin).remember_me_for 1.week
|
77
|
+
after = 1.week.from_now.utc
|
78
|
+
assert_not_nil users(:quentin).remember_token
|
79
|
+
assert_not_nil users(:quentin).remember_token_expires_at
|
80
|
+
assert users(:quentin).remember_token_expires_at.between?(before, after)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_should_remember_me_until_one_week
|
84
|
+
time = 1.week.from_now.utc
|
85
|
+
users(:quentin).remember_me_until time
|
86
|
+
assert_not_nil users(:quentin).remember_token
|
87
|
+
assert_not_nil users(:quentin).remember_token_expires_at
|
88
|
+
assert_equal users(:quentin).remember_token_expires_at, time
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_should_remember_me_default_two_weeks
|
92
|
+
before = 2.weeks.from_now.utc
|
93
|
+
users(:quentin).remember_me
|
94
|
+
after = 2.weeks.from_now.utc
|
95
|
+
assert_not_nil users(:quentin).remember_token
|
96
|
+
assert_not_nil users(:quentin).remember_token_expires_at
|
97
|
+
assert users(:quentin).remember_token_expires_at.between?(before, after)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_should_normalize_open_id_url_before_save
|
101
|
+
users(:quentin).update_attribute(:open_id, @open_id)
|
102
|
+
assert_equal("#{@open_id}/", users(:quentin).open_id)
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_should_respond_to_roles_methods
|
106
|
+
# Forcing ActsAsRoled inclusion
|
107
|
+
User.class_eval { include ActsAsRoled }
|
108
|
+
assert users(:quentin).user?
|
109
|
+
assert users(:admin).admin?
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_should_remove_roles
|
113
|
+
assert_difference('users(:quentin).roles.size') do
|
114
|
+
users(:quentin).update_attributes(:roles_attributes => ['user', 'admin'])
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_should_remove_roles
|
119
|
+
assert_difference('users(:quentin).roles.size', -1) do
|
120
|
+
users(:quentin).update_attributes(:roles_attributes => [])
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_should_switch_roles
|
125
|
+
assert_no_difference('users(:quentin).roles.size') do
|
126
|
+
users(:quentin).update_attributes(:roles_attributes => ['admin'])
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
protected
|
131
|
+
def create_user(options = {})
|
132
|
+
User.create({ :login => 'quire', :email => 'quire@example.com', :password => 'quire', :password_confirmation => 'quire' }.merge(options))
|
133
|
+
end
|
134
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<div class="background_box">
|
2
|
+
<div class="background_item"><b>Started at:</b> <%= @job.started_at.strftime("%m/%d/%Y %H:%M:%S") %></div>
|
3
|
+
<div class="background_item"><b>Finished at:</b> <%= @job.finished_at.strftime("%m/%d/%Y %H:%M:%S") %></div>
|
4
|
+
<div class="background_item"><b>Ran for:</b> <%= job_duration %></div>
|
5
|
+
<div class="background_item"><b>Exit Status:</b> <%= @job.exit_status %></div>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="background_item"><%= stdout_link %></div>
|
9
|
+
<div class="background_item"><%= stderr_link %></div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div class="background_item"><b>Job is waiting to be executed, priority: <%= @job.priority %></p></div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if @progress_job%>
|
2
|
+
|
3
|
+
<div class="background_progress" >
|
4
|
+
<div class="background_progress_bar "style="width: <%= (@progress_job.percentage * 6) %>px;">
|
5
|
+
<span class="background_progress_caption">
|
6
|
+
<%= @progress_job.progress_message %> <%= @progress_job.percentage %>% (<%= progress_eta %>)
|
7
|
+
</span>
|
8
|
+
</div>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<% else %>
|
12
|
+
<div class="background_item"><b>No progress information available.</b></div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<div class="background_item"><b>Job is running since <%= @job.started_at.strftime("%m/%d/%Y %H:%M:%S") %> (<%= job_duration %>)</b></div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% @progress_job = TaliaCore::BackgroundJobs::ProgressJob.find(:first, :conditions => { :job_id => @job.id }) %>
|
2
|
+
<%= periodically_call_remote(:url => { :action => 'update_progress', :id => @job.id }, :frequency => '3', :update => 'back_progress') %>
|
3
|
+
|
4
|
+
<div class="background_box" id="back_progress">
|
5
|
+
<%= render :partial => 'progress' %>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="background_box">
|
9
|
+
|
10
|
+
<div class="background_item"><b>Process ID:</b> <%= @job.pid %></div>
|
11
|
+
</div>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="backlink"><%= job_link %></div>
|
2
|
+
<h2>Runtime Environment Variables:</h2>
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Variable</th><th>Value</th>
|
6
|
+
</tr>
|
7
|
+
<% @environment.each do |k,v| %>
|
8
|
+
<tr style="background-color: <%= cycle('#E0E0E0', '#FFFFFF') %>;">
|
9
|
+
<td><%= k %></td><td><%= v %></td>
|
10
|
+
</tr>
|
11
|
+
<% end %>
|
12
|
+
</table>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<div class="backlink"><%= link_to 'Job list', :action => 'index' %></div>
|
2
|
+
<h2>Job <%= @job.id %><% job_tag %></h2>
|
3
|
+
|
4
|
+
<div class="background_box">
|
5
|
+
<div class="background_item"><b>Priority:</b> <%= @job.priority %></div>
|
6
|
+
<div class="background_item"><b>Submitter:</b> <%= @job.submitter %></div>
|
7
|
+
<div class="background_item"><b>Submitted at:</b> <%= @job.submitted_at.strftime("%m/%d/%Y %H:%M:%S") %></div>
|
8
|
+
<% if @job.runner %>
|
9
|
+
<div class="background_item"><b>Runner:</b> <%= @job.runner %></div>
|
10
|
+
<% end %>
|
11
|
+
<div class="background_item"><b>Command:</b> <%= @job.command %></div>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<%= render_job %>
|
15
|
+
|
16
|
+
<div class="background_item"><%= environment_link %></div>
|
17
|
+
<div class="background_item"><%= stdin_link %></div>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<% form_tag :controller => 'admin/locales', :action => 'create' do -%>
|
2
|
+
<p><label for="name">Name</label><br/>
|
3
|
+
<%= text_field_tag 'name' %> <span class="small grey italic">(example: English)</span></p>
|
4
|
+
|
5
|
+
<p><label for="code">Code</label><br/>
|
6
|
+
<%= text_field_tag 'code' %> <span class="small grey italic">(example: en-US)</span></p>
|
7
|
+
|
8
|
+
<p><%= submit_tag 'Create' %> or <%= link_to "back to the translations", admin_translations_path %></p>
|
9
|
+
<% end %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<li>
|
2
|
+
<%= file_type(data.type) %> <%= link_to data.location, :controller => '/source_data', :action => 'show', :type => data.type, :location => data.location %>
|
3
|
+
<%= link_to_remote image_tag('trash.gif', :class => 'trash'),
|
4
|
+
:url => {:controller => '/source_data', :action => 'destroy', :id => data },
|
5
|
+
:method => :delete, :confirm => 'Are you sure?' %>
|
6
|
+
</li>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<h2>Files</h2>
|
2
|
+
<div id="data">
|
3
|
+
<%= render :partial => "list" %>
|
4
|
+
|
5
|
+
<p><%= show_upload_form %></p>
|
6
|
+
<div id="data_form">
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<script type="text/javascript" charset="utf-8">
|
11
|
+
var authenticityToken = '<%= protect_against_forgery? ? form_authenticity_token : "" %>';
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<%= javascript_include_tag 'controls', 'force_identify', 'edit_sources' %>
|
15
|
+
<%= stylesheet_link_tag 'auto_complete' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<div id="data_notice" class="notice"><%= h text %></div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div class="predicate">
|
2
|
+
<% fields_for "source[predicates_attributes][]", predicate do |predicate_form|%>
|
3
|
+
<%= predicate_form.text_field :name, :index => nil, :value => name, :size => 20 %>
|
4
|
+
<%= predicate_form.text_field :titleized, :index => nil, :size => 60, :autocomplete => :off %>
|
5
|
+
<%= predicate_form.hidden_field :namespace, :index => nil, :value => namespace %>
|
6
|
+
<%= predicate_form.hidden_field :uri, :index => nil %>
|
7
|
+
<%= hidden_field_tag 'source', predicate.is_a?(TaliaCore::ActiveSource), :id => 'source_predicates_attributes__source',
|
8
|
+
:name => "source[predicates_attributes][][source]", :class => 'source' %>
|
9
|
+
<% unless @source.associated?(namespace, name, predicate.titleized) %>
|
10
|
+
<%= link_to_function image_tag('remove.png', :size => '12x12', :alt => 'remove', :class => 'remove'),
|
11
|
+
"remove_from_collection(this, '.predicate')" %>
|
12
|
+
<% else %>
|
13
|
+
<%= link_to_function image_tag('remove.png', :size => '12x12', :alt => 'remove', :class => 'remove'),
|
14
|
+
"mark_for_destroy(this, '.predicate')" %>
|
15
|
+
<%= predicate_form.hidden_field :id, :index => nil %>
|
16
|
+
<%= hidden_field_tag 'should_destroy', nil, :class => "should_destroy",
|
17
|
+
:id => 'source_predicates_attributes__should_destroy',
|
18
|
+
:name => 'source[predicates_attributes][][should_destroy]' %>
|
19
|
+
<% end %>
|
20
|
+
<div class="auto_complete"></div>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% @source.grouped_direct_predicates.each do |namespace, group| %>
|
2
|
+
<div id="<%=h namespace.underscore %>">
|
3
|
+
<p class="rdf_header">
|
4
|
+
<%= image_tag 'arrow_grouped.png', :size => '12x12', :class => 'arrow_grouped' %>
|
5
|
+
<%=h namespace.titleize %>
|
6
|
+
<%= add_another_predicate namespace %>
|
7
|
+
</p>
|
8
|
+
<div class="predicates">
|
9
|
+
<% group.each do |name, sources| %>
|
10
|
+
<%= render :partial => "predicate", :collection => sources.flatten, :locals => { :namespace => namespace, :name => name } %>
|
11
|
+
<% end %>
|
12
|
+
<div id="new_predicates_for_<%=h namespace.underscore %>"></div>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<table border="0" cellspacing="0" cellpadding="5">
|
2
|
+
<tr>
|
3
|
+
<th class="horizontal">Name</th>
|
4
|
+
<th class="horizontal">Workflow State</th>
|
5
|
+
<th class="horizontal"></th>
|
6
|
+
</tr>
|
7
|
+
<% for source in @sources -%>
|
8
|
+
<tr class="<%= cycle("odd", "even") -%>">
|
9
|
+
<% uri, name = escaped_source_identifiers(source) -%>
|
10
|
+
<td><a href="<%=h uri %>" title="<%=h name.titleize %>"><%=h name.titleize %></a></td>
|
11
|
+
<td><%= link_to 'Edit', url_for(:action => :edit, :id => unescape_link(name)) %></td>
|
12
|
+
</tr>
|
13
|
+
<% end -%>
|
14
|
+
</table>
|
15
|
+
|
16
|
+
<br />
|
17
|
+
<%= will_paginate @sources %>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= form_tag_with_upload_progress({:controller => '/source_data', :action => 'create'}, {:finish => 'onFinishedUpload()'}, {:controller => '/source_data'}) %>
|
2
|
+
<%= hidden_field_tag 'data_record[source_record_id]', @source.id %>
|
3
|
+
<%= file_field "data_record", "file" %>
|
4
|
+
<%= submit_tag "Upload", :id => 'data_record_submit', :onclick => 'showUploadProgressBar();' %> or <%= hide_upload_form %>
|
5
|
+
<%= upload_status_tag %>
|
6
|
+
</form>
|
@@ -0,0 +1,6 @@
|
|
1
|
+
<%= error_messages_for 'source' %>
|
2
|
+
<% form_tag(admin_source_path(@source), {:method => :put, :html => {:id => 'source_edit'}}) do %>
|
3
|
+
<%= render :partial => 'form' %>
|
4
|
+
<p><%= submit_tag "submit" %> or <%= link_to "Back", :action => 'index' %></p>
|
5
|
+
<% end %>
|
6
|
+
<%= render :partial => 'data_form' %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<tr class="translation">
|
2
|
+
<td><%= text_field_tag "translations[][tr_key]", new_translation.tr_key, :size => 12 %></td>
|
3
|
+
<td>
|
4
|
+
<%= text_field_tag "translations[][text]", new_translation.text, :size => 48 %>
|
5
|
+
<%= hidden_field_tag "translations[][id]", new_translation.id %>
|
6
|
+
</td>
|
7
|
+
</tr>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<tr>
|
2
|
+
<td>
|
3
|
+
<%= label_tag "translations[][text]", translation.tr_key %>
|
4
|
+
<%= hidden_field_tag "translations[][tr_key]", translation.tr_key %>
|
5
|
+
</td>
|
6
|
+
<td>
|
7
|
+
<%= text_field_tag "translations[][text]", translation.text, :size => 48 %>
|
8
|
+
<%= hidden_field_tag "translations[][id]", translation.id %>
|
9
|
+
</td>
|
10
|
+
</tr>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= languages_picker %>
|
2
|
+
<% autoload_reference_translations %>
|
3
|
+
<%= javascript_include_tag 'translations' %>
|
4
|
+
<% form_tag(admin_translation_path(@locale_code), :method => :put) do -%>
|
5
|
+
<p style="margin-top: 2ex"><%= submit_tag %></p>
|
6
|
+
<table id="translations" border="0" cellspacing="5" cellpadding="5">
|
7
|
+
<tr><td></td><td></td></tr>
|
8
|
+
<tr>
|
9
|
+
<th>Key</th>
|
10
|
+
<th>Translation</th>
|
11
|
+
</tr>
|
12
|
+
<%= render :partial => 'translation', :collection => @translations %>
|
13
|
+
</table>
|
14
|
+
<p><%= add_translation %></p>
|
15
|
+
<p><%= submit_tag %></p>
|
16
|
+
<% end -%>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<p><label for="user_login">login</label><br/>
|
2
|
+
<%= text_field 'user', 'login', :value => @user.login, :tabindex => 10 %></p>
|
3
|
+
<p><label for="user_email">E-Mail</label><br/>
|
4
|
+
<%= text_field 'user', 'email', :value => @user.email, :tabindex => 20 %></p>
|
5
|
+
<p><label for="user_password">Password</label><br/>
|
6
|
+
<%= password_field 'user', 'password', :value => @user.password, :tabindex => 30 %></p>
|
7
|
+
<p><label for="user_password_confirmation">Password Confirmation</label><br/>
|
8
|
+
<%= password_field 'user', 'password_confirmation', :value => @user.password_confirmation, :tabindex => 40 %></p>
|
9
|
+
<p><label for="user_open_id">OpenID</label><br/>
|
10
|
+
<%= text_field 'user', 'open_id', :value => @user.open_id, :tabindex => 50 %></p>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<% for role in Role.find(:all) %>
|
2
|
+
<% fields_for "user[roles_attributes][]", role do |role_form| %>
|
3
|
+
<p>
|
4
|
+
<%= check_box_tag "user[roles_attributes][]", role.name, @user.has_role?(role.name), :id => "user_roles_attributes_#{role.id}" %>
|
5
|
+
<label for="user_roles_attributes_<%= role.id %>"><%=h role.name.titleize %></label>
|
6
|
+
</p>
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= error_messages_for :user %>
|
2
|
+
<h1>Edit User</h1>
|
3
|
+
<% form_for(:user, @user, :url => {:controller => 'admin/users', :action => 'update', :id => @user}, :html => {:method => :put}) do |f| %>
|
4
|
+
<% field_set_tag 'Personal data' do %>
|
5
|
+
<%= render :partial => "form" %>
|
6
|
+
<% end %>
|
7
|
+
<% field_set_tag 'Roles' do %>
|
8
|
+
<%= render :partial => "form_roles" %>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<p><%= f.submit "submit" %> or <%= link_to "cancel", :action => "index" %></p>
|
12
|
+
<% end %>
|