talia_core 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. data/VERSION.yml +1 -1
  2. data/generators/generator_helpers.rb +35 -2
  3. data/generators/talia_admin/talia_admin_generator.rb +6 -0
  4. data/generators/talia_admin/templates/controllers/admin/background_controller.rb +2 -0
  5. data/generators/talia_admin/templates/controllers/admin/roles_controller.rb +8 -0
  6. data/generators/talia_admin/templates/controllers/admin/sources_controller.rb +2 -64
  7. data/generators/talia_admin/templates/controllers/admin/users_controller.rb +3 -41
  8. data/generators/talia_admin/templates/controllers/admin_controller.rb +1 -1
  9. data/generators/talia_admin/templates/helpers/admin/roles_helper.rb +2 -0
  10. data/generators/talia_admin/templates/helpers/admin/users_helper.rb +9 -0
  11. data/generators/talia_admin/templates/helpers/admin_helper.rb +19 -0
  12. data/generators/{talia_base → talia_admin}/templates/migrations/populate_users.rb +5 -2
  13. data/generators/talia_admin/templates/models/role.rb +3 -0
  14. data/generators/talia_admin/templates/public/stylesheets/backend.css +1 -4
  15. data/generators/talia_admin/templates/views/admin/index.html.erb +3 -3
  16. data/generators/talia_admin/templates/views/admin/sources/_show.html.erb +13 -0
  17. data/generators/talia_admin/templates/views/layouts/admin.html.erb +5 -5
  18. data/generators/talia_base/talia_base_generator.rb +11 -18
  19. data/generators/talia_base/templates/README +15 -0
  20. data/generators/talia_base/templates/app/controllers/sources_controller.rb +125 -7
  21. data/generators/talia_base/templates/app/helpers/sources_helper.rb +19 -35
  22. data/generators/talia_base/templates/app/views/sources/index.html.erb +12 -1
  23. data/generators/talia_base/templates/app/views/sources/semantic_templates/default/default.html.erb +21 -0
  24. data/generators/talia_base/templates/app/views/sources/semantic_templates/default/province.html.erb +19 -0
  25. data/generators/talia_base/templates/config/routes.rb +24 -4
  26. data/generators/talia_base/templates/script/setup_talia_backend +35 -0
  27. data/lib/loader_helper.rb +8 -1
  28. data/lib/talia_core/active_source.rb +9 -6
  29. data/lib/talia_core/active_source_parts/class_methods.rb +2 -1
  30. data/lib/talia_core/active_source_parts/predicate_handler.rb +12 -0
  31. data/lib/talia_core/active_source_parts/rdf.rb +1 -1
  32. data/lib/talia_core/data_types/iip_loader.rb +2 -0
  33. data/lib/talia_core/dc_resource.rb +1 -1
  34. data/lib/talia_core/initializer.rb +2 -0
  35. data/lib/talia_core/semantic_relation.rb +1 -1
  36. data/lib/talia_util/rake_tasks.rb +2 -2
  37. data/lib/talia_util/util.rb +1 -1
  38. data/test/talia_core/active_source_predicate_test.rb +2 -6
  39. data/test/talia_core/active_source_rdf_test.rb +9 -5
  40. data/test/talia_core/active_source_test.rb +50 -44
  41. data/test/talia_core/data_types/data_loader_test.rb +2 -2
  42. data/test/talia_core/data_types/data_record_test.rb +1 -1
  43. data/test/talia_core/data_types/file_record_test.rb +4 -3
  44. data/test/talia_core/data_types/iip_data_test.rb +2 -2
  45. data/test/talia_core/data_types/image_data_test.rb +1 -1
  46. data/test/talia_core/data_types/pdf_data_test.rb +1 -1
  47. data/test/talia_core/data_types/xml_data_test.rb +3 -2
  48. data/test/talia_core/initializer_test.rb +1 -1
  49. data/test/talia_core/ordered_source_test.rb +1 -5
  50. data/test/talia_core/rdf_resource_test.rb +1 -5
  51. data/test/talia_core/semantic_collection_item_test.rb +3 -7
  52. data/test/talia_core/source_test.rb +7 -12
  53. data/test/talia_core/workflow/publication_workflow_test.rb +36 -23
  54. data/test/talia_util/import_job_helper_test.rb +1 -5
  55. data/test/test_helper.rb +18 -5
  56. metadata +11 -52
  57. data/generators/talia_admin/templates/test/fixtures/users.yml +0 -32
  58. data/generators/talia_admin/templates/test/unit/user_test.rb +0 -134
  59. data/generators/talia_admin/templates/views/admin/sources/_data.html.erb +0 -6
  60. data/generators/talia_admin/templates/views/admin/sources/_data_form.html.erb +0 -15
  61. data/generators/talia_admin/templates/views/admin/sources/_form.html.erb +0 -7
  62. data/generators/talia_admin/templates/views/admin/sources/_list.html.erb +0 -3
  63. data/generators/talia_admin/templates/views/admin/sources/_notice.html.erb +0 -1
  64. data/generators/talia_admin/templates/views/admin/sources/_predicate.html.erb +0 -22
  65. data/generators/talia_admin/templates/views/admin/sources/_predicates.html.erb +0 -15
  66. data/generators/talia_admin/templates/views/admin/sources/_sources.html.erb +0 -17
  67. data/generators/talia_admin/templates/views/admin/sources/_upload.html.erb +0 -6
  68. data/generators/talia_admin/templates/views/admin/sources/edit.html.erb +0 -6
  69. data/generators/talia_admin/templates/views/admin/sources/index.html.erb +0 -5
  70. data/generators/talia_admin/templates/views/admin/users/_form.html.erb +0 -10
  71. data/generators/talia_admin/templates/views/admin/users/_form_roles.html.erb +0 -8
  72. data/generators/talia_admin/templates/views/admin/users/edit.html.erb +0 -12
  73. data/generators/talia_admin/templates/views/admin/users/index.html.erb +0 -22
  74. data/generators/talia_admin/templates/views/admin/users/new.html.erb +0 -5
  75. data/generators/talia_admin/templates/views/admin/users/show.html.erb +0 -6
  76. data/generators/talia_base/templates/app/controllers/sessions_controller.rb +0 -90
  77. data/generators/talia_base/templates/app/controllers/source_data/show.html.erb +0 -2
  78. data/generators/talia_base/templates/app/helpers/source_data/show.html.erb +0 -2
  79. data/generators/talia_base/templates/app/views/sessions/new.html.erb +0 -33
  80. data/generators/talia_base/templates/migrations/create_open_id.rb +0 -26
  81. data/generators/talia_base/templates/migrations/create_roles.rb +0 -20
  82. data/generators/talia_base/templates/migrations/create_sessions.rb +0 -16
  83. data/generators/talia_base/templates/migrations/create_users.rb +0 -20
  84. data/lib/role.rb +0 -12
  85. data/lib/talia_cl/command_line.rb +0 -39
  86. data/lib/talia_cl/commands/standalone/cl_options.rb +0 -9
  87. data/lib/talia_cl/commands/standalone/standalone_generate.rb +0 -75
  88. data/lib/talia_cl/commands/standalone.rb +0 -25
  89. data/lib/talia_cl/commands/talia_console/cl_options.rb +0 -55
  90. data/lib/talia_cl/commands/talia_console/console_commands.rb +0 -37
  91. data/lib/talia_cl/commands/talia_console/talia_commands.rb +0 -131
  92. data/lib/talia_cl/commands/talia_console.rb +0 -47
  93. data/lib/talia_cl/core_commands.rb +0 -11
  94. data/lib/talia_cl.rb +0 -47
  95. data/lib/user.rb +0 -116
@@ -1,134 +0,0 @@
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
@@ -1,6 +0,0 @@
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>
@@ -1,15 +0,0 @@
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' %>
@@ -1,7 +0,0 @@
1
- <h2>Attributes</h2>
2
- <p><strong>URI: <a href="<%=h @source.uri %>" title="<%=h @source.uri %>"><%=h @source.uri %></a></strong></p>
3
-
4
- <h2>RDF Predicates</h2>
5
- <div id="predicates">
6
- <%= render :partial => "predicates" %>
7
- </div>
@@ -1,3 +0,0 @@
1
- <ul id="list">
2
- <%= render :partial => "data", :collection => @source.data %>
3
- </ul>
@@ -1 +0,0 @@
1
- <div id="data_notice" class="notice"><%= h text %></div>
@@ -1,22 +0,0 @@
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>
@@ -1,15 +0,0 @@
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 %>
@@ -1,17 +0,0 @@
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 %>
@@ -1,6 +0,0 @@
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>
@@ -1,6 +0,0 @@
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' %>
@@ -1,5 +0,0 @@
1
- <h1>Sources</h1>
2
- <div id="sources">
3
- <%= render :partial => 'sources' %>
4
- </div>
5
- <% content_for :javascript, javascript_include_tag('sources') %>
@@ -1,10 +0,0 @@
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>
@@ -1,8 +0,0 @@
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 %>
@@ -1,12 +0,0 @@
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 %>
@@ -1,22 +0,0 @@
1
- <table id="translations">
2
- <tr>
3
- <th>Login</th>
4
- <th>E-Mail</th>
5
- <th colspan="3"></th>
6
- </tr>
7
- <% for user in @users %>
8
- <tr>
9
- <td><%=h user.login %></td>
10
- <td><%=h user.email %></td>
11
- <td><%= link_to "Show", :action => 'show', :id => user %></td>
12
- <td><%= link_to "Edit", :action => 'edit', :id => user %></td>
13
- <td><%= link_to "Destroy", :action => 'destroy', :id => user, :confirm => 'Are you sure?', :method => :delete %></td>
14
- </tr>
15
- <% end %>
16
- </table>
17
- <br />
18
-
19
- <%= will_paginate @users %>
20
-
21
- <br />
22
- <%= link_to "Create new user", :action => "new" %>
@@ -1,5 +0,0 @@
1
- <%= error_messages_for :user %>
2
- <% form_for(@user, :url => {:controller => 'admin/users', :action => 'create'}) do |f| %>
3
- <%= render :partial => "form" %>
4
- <p><%= f.submit "submit" %> or <%= link_to "cancel", :action => 'index' %></p>
5
- <% end %>
@@ -1,6 +0,0 @@
1
- <h1><%=h @user.login %></h1>
2
- <p><%= link_to h(@user.open_id), h(@user.open_id) %></p>
3
- <h2>Roles</h2>
4
- <div><%=h @user.roles_to_sentence %></div><br />
5
-
6
- <%= link_to "Back", :action => 'index' %> | <%= link_to "Edit", :action => 'edit', :id => @user %>
@@ -1,90 +0,0 @@
1
- # This controller handles the login/logout function of the site.
2
- class SessionsController < ApplicationController
3
-
4
- cache_sweeper :editions_sweeper, :only => [:destroy]
5
- layout 'admin'
6
-
7
- # render new.rhtml
8
- def new
9
- end
10
-
11
- # login
12
- def create
13
- if using_open_id?
14
- open_id_authentication(params[:openid_url])
15
- else
16
- password_authentication(params[:login], params[:password])
17
- end
18
- end
19
-
20
- # logout
21
- def destroy
22
- if logged_in?
23
- self.current_user.forget_me
24
- empty_cache = true
25
- end
26
- cookies.delete :auth_token
27
- reset_session
28
- flash[:notice] = "You have been logged out."
29
- # When a translator logs out, we want to perform a cache cleaning, since we don't
30
- # know what that translator changed and where.
31
- # Still, we don't want to perform the cache cleaning any time a user invokes the
32
- # /logout URL
33
- # To check if we are _actually_ performing a logout, we check if we were logged_in?
34
- #
35
- # TODO: why are we still logged in here?
36
- if empty_cache
37
- # TODO: since we are still logged in here (why?), we need to empty the @current_user val
38
- # otherwise the perform_caching method (in the application controller) will return false
39
- # (as it esplicitely shuts down the caching when a user is logged in)
40
- @current_user = nil
41
- EditionsSweeper.instance.clean_cache
42
- end
43
- redirect_back_or_default('/')
44
- end
45
-
46
- protected
47
-
48
- # password authentication
49
- def password_authentication(login, password)
50
- self.current_user = User.authenticate(login, password)
51
- if logged_in?
52
- successful_login
53
- else
54
- failed_login
55
- end
56
- end
57
-
58
- # open id authentication
59
- def open_id_authentication(identity_url)
60
- authenticate_with_open_id(identity_url) do |status, identity_url|
61
- if status.successful?
62
- if self.current_user = User.open_id_authentication(identity_url)
63
- successful_login
64
- else
65
- failed_login "Sorry, no user by that identity URL exists (#{identity_url})"
66
- end
67
- else
68
- failed_login status.message
69
- end
70
- end
71
- end
72
-
73
- private
74
-
75
- # login successful
76
- def successful_login
77
- if params[:remember_me] == "1"
78
- self.current_user.remember_me
79
- cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at }
80
- end
81
- redirect_back_or_default('/')
82
- flash[:notice] = "Logged in successfully"
83
- end
84
-
85
- # login failed
86
- def failed_login(message = nil)
87
- flash[:error] = message if !message.nil?
88
- render :action => 'new'
89
- end
90
- end
@@ -1,2 +0,0 @@
1
- <h1>SourceData#show</h1>
2
- <p>Find me in app/views/source_data/show.html.erb</p>
@@ -1,2 +0,0 @@
1
- <h1>SourceData#show</h1>
2
- <p>Find me in app/views/source_data/show.html.erb</p>
@@ -1,33 +0,0 @@
1
- <div id="password_login">
2
- <% form_tag session_path do -%>
3
- <p><label for="login">Login</label><br/>
4
- <%= text_field_tag 'login' %></p>
5
-
6
- <p><label for="password">Password</label><br/>
7
- <%= password_field_tag 'password' %></p>
8
- <!-- Uncomment this if you want this functionality
9
- <p><label for="remember_me">Remember me:</label>
10
- <%= check_box_tag 'remember_me' %></p>
11
- -->
12
-
13
- <p><%= submit_tag 'Log in' %></p>
14
- <% end -%>
15
- <a href="#">switch to open-id login</a>
16
- </div>
17
-
18
- <div id="openid_login">
19
- <% form_tag session_path do -%>
20
- <p><label for="openid_url">OpenId</label><br/>
21
- <%= text_field_tag 'openid_url' %></p>
22
-
23
- <!-- Uncomment this if you want this functionality
24
- <p><label for="remember_me">Remember me:</label>
25
- <%= check_box_tag 'remember_me' %></p>
26
- -->
27
-
28
- <p><%= submit_tag 'Log in' %></p>
29
- <% end -%>
30
- <a href="#">switch to username/password login</a>
31
- </div>
32
-
33
- <%= javascript_include_tag('session') %>
@@ -1,26 +0,0 @@
1
- class CreateOpenId < ActiveRecord::Migration
2
- def self.up
3
- create_table :open_id_authentication_associations, :force => true do |t|
4
- t.integer :issued, :lifetime
5
- t.string :handle, :assoc_type
6
- t.binary :server_url, :secret
7
- end
8
-
9
- create_table :open_id_authentication_nonces, :force => true do |t|
10
- t.integer :timestamp, :null => false
11
- t.string :server_url, :null => true
12
- t.string :salt, :null => false
13
- end
14
-
15
- # add open_id column to users
16
- add_column :users, :open_id, :string, :default => nil
17
- end
18
-
19
- def self.down
20
- # remove open_id column from users
21
- remove_column :users, :open_id
22
-
23
- drop_table :open_id_authentication_associations
24
- drop_table :open_id_authentication_nonces
25
- end
26
- end
@@ -1,20 +0,0 @@
1
- class CreateRoles < ActiveRecord::Migration
2
- def self.up
3
- create_table "roles" do |t|
4
- t.column :name, :string
5
- end
6
-
7
- # generate the join table
8
- create_table "roles_users", :id => false do |t|
9
- t.column "role_id", :integer
10
- t.column "user_id", :integer
11
- end
12
- add_index "roles_users", "role_id"
13
- add_index "roles_users", "user_id"
14
- end
15
-
16
- def self.down
17
- drop_table "roles"
18
- drop_table "roles_users"
19
- end
20
- end
@@ -1,16 +0,0 @@
1
- class CreateSessions < ActiveRecord::Migration
2
- def self.up
3
- create_table :sessions do |t|
4
- t.string :session_id, :null => false
5
- t.text :data
6
- t.timestamps
7
- end
8
-
9
- add_index :sessions, :session_id
10
- add_index :sessions, :updated_at
11
- end
12
-
13
- def self.down
14
- drop_table :sessions
15
- end
16
- end
@@ -1,20 +0,0 @@
1
- class CreateUsers < ActiveRecord::Migration
2
- def self.up
3
- create_table "users", :force => true do |t|
4
- t.column :login, :string
5
- t.column :email, :string
6
- t.column :crypted_password, :string, :limit => 40
7
- t.column :salt, :string, :limit => 40
8
- t.column :created_at, :datetime
9
- t.column :updated_at, :datetime
10
- t.column :remember_token, :string
11
- t.column :remember_token_expires_at, :datetime
12
-
13
-
14
- end
15
- end
16
-
17
- def self.down
18
- drop_table "users"
19
- end
20
- end
data/lib/role.rb DELETED
@@ -1,12 +0,0 @@
1
- class Role < ActiveRecord::Base
2
- has_and_belongs_to_many :users
3
-
4
- def self.find_all_names
5
- self.find(:all, :select => :name).map(&:name)
6
- end
7
-
8
- def self.find_by_names(names)
9
- names = names.map(&:to_s)
10
- self.find(:all, :conditions => [ "name IN (?)", names])
11
- end
12
- end
@@ -1,39 +0,0 @@
1
- #
2
- # This are the methods to set up the commands for the talia command line tool.
3
- #
4
- module TaliaCommandLine
5
-
6
- # Hash with the command line commands
7
- @commands = {}
8
-
9
- # Set command description
10
- def self.desc(description)
11
- @description = description
12
- end
13
-
14
- # Create a new command for the command line
15
- def self.command(name, &block)
16
- description = @description ? @description : ""
17
- @commands[name.to_sym] = [ description, block ]
18
- end
19
-
20
- # Run this to iterate through all the commands. This will pass the following
21
- # parameters to the block: command name, description
22
- def self.each(&block)
23
- @commands.each do |key, value|
24
- block.call(key, value[0], value[1])
25
- end
26
- end
27
-
28
- # Returns true if the command exists
29
- def self.command?(command)
30
- command && @commands[command.to_sym] != nil
31
- end
32
-
33
- # Run the given command
34
- def self.run_command(command, *options)
35
- raise(RuntimeError, "Command does not exist: #{command}") unless @commands[command.to_sym]
36
- @commands[command.to_sym][1].call(*options)
37
- end
38
-
39
- end
@@ -1,9 +0,0 @@
1
- require 'rubygems'
2
- gem 'optiflag'
3
- require 'optiflag'
4
-
5
- # Parse for the command line
6
- module TaliaCommands extend OptiFlagSet
7
-
8
- and_process!
9
- end