inkling 0.0.3a
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +194 -0
- data/app/controllers/inkling/admin/base_controller.rb +5 -0
- data/app/controllers/inkling/admin/content_types_controller.rb +4 -0
- data/app/controllers/inkling/admin/permissions_controller.rb +4 -0
- data/app/controllers/inkling/admin/roles_controller.rb +4 -0
- data/app/controllers/inkling/admin/users_controller.rb +4 -0
- data/app/controllers/inkling/base_controller.rb +9 -0
- data/app/controllers/inkling/content_controller.rb +6 -0
- data/app/controllers/inkling/home_controller.rb +44 -0
- data/app/controllers/inkling/paths_controller.rb +31 -0
- data/app/controllers/inkling/proxying_controller.rb +19 -0
- data/app/controllers/inkling/themes_controller.rb +4 -0
- data/app/controllers/inkling/users/confirmations_controller.rb +3 -0
- data/app/controllers/inkling/users/passwords_controller.rb +1 -0
- data/app/controllers/inkling/users/sessions_controller.rb +5 -0
- data/app/models/inkling/can_can_action.rb +5 -0
- data/app/models/inkling/log.rb +3 -0
- data/app/models/inkling/path.rb +54 -0
- data/app/models/inkling/permission.rb +7 -0
- data/app/models/inkling/role.rb +10 -0
- data/app/models/inkling/role_membership.rb +8 -0
- data/app/models/inkling/theme.rb +74 -0
- data/app/models/inkling/type.rb +4 -0
- data/app/models/inkling/user.rb +16 -0
- data/app/views/inkling/admin/permissions/_form.html.erb +15 -0
- data/app/views/inkling/admin/permissions/edit.html.erb +1 -0
- data/app/views/inkling/admin/permissions/index.html.erb +26 -0
- data/app/views/inkling/admin/permissions/new.html.erb +1 -0
- data/app/views/inkling/admin/permissions/show.html.erb +11 -0
- data/app/views/inkling/admin/roles/index.html.erb +3 -0
- data/app/views/inkling/admin/sites/index.html.erb +1 -0
- data/app/views/inkling/admin/types/index.html.erb +12 -0
- data/app/views/inkling/admin/users/_form.html.erb +16 -0
- data/app/views/inkling/admin/users/edit.html.erb +1 -0
- data/app/views/inkling/admin/users/index.html.erb +18 -0
- data/app/views/inkling/admin/users/new.html.erb +1 -0
- data/app/views/inkling/admin/users/show.html.erb +11 -0
- data/app/views/inkling/home/_dashboard.html.erb +29 -0
- data/app/views/inkling/home/dashboard.html.erb +13 -0
- data/app/views/inkling/paths/_content_form.html.erb +7 -0
- data/app/views/inkling/paths/_path.html.erb +17 -0
- data/app/views/inkling/paths/index.html.erb +14 -0
- data/app/views/inkling/paths/update_tree.js.erb +2 -0
- data/app/views/inkling/themes/_form.html.erb +17 -0
- data/app/views/inkling/themes/edit.html.erb +1 -0
- data/app/views/inkling/themes/index.html.erb +11 -0
- data/app/views/inkling/themes/new.html.erb +1 -0
- data/app/views/inkling/themes/show.html.erb +1 -0
- data/app/views/inkling/users/confirmations/new.html.erb +12 -0
- data/app/views/inkling/users/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/inkling/users/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/inkling/users/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/inkling/users/passwords/edit.html.erb +16 -0
- data/app/views/inkling/users/passwords/new.html.erb +12 -0
- data/app/views/inkling/users/registrations/edit.html.erb +25 -0
- data/app/views/inkling/users/registrations/new.html.erb +18 -0
- data/app/views/inkling/users/sessions/new.html.erb +17 -0
- data/app/views/inkling/users/shared/_links.erb +19 -0
- data/app/views/inkling/users/unlocks/new.html.erb +12 -0
- data/app/views/layouts/inkling/admin.html.erb +43 -0
- data/app/views/layouts/inkling/manage.html.erb +43 -0
- data/bin/inkling +3 -0
- data/config/initializers/init.rb +4 -0
- data/config/initializers/rspec_generator.rb +6 -0
- data/config/routes.rb +18 -0
- data/lib/generators/inkling_generator.rb +19 -0
- data/lib/generators/templates/create_inkling_tables.rb +73 -0
- data/lib/inkling/ability.rb +21 -0
- data/lib/inkling/commands/generator.rb +66 -0
- data/lib/inkling/commands.rb +12 -0
- data/lib/inkling/engine.rb +35 -0
- data/lib/inkling/routing.rb +26 -0
- data/lib/inkling/slugs.rb +17 -0
- data/lib/inkling/types.rb +61 -0
- data/lib/inkling/util/migration_helpers.rb +22 -0
- data/lib/inkling/version.rb +3 -0
- data/lib/inkling.rb +3 -0
- data/lib/tasks/cucumber.rake +53 -0
- data/lib/tasks/inkling.rake +48 -0
- data/lib/tasks/rspec.rake +68 -0
- data/spec/controllers/inkling/proxying_spec.rb +9 -0
- data/spec/models/path_spec.rb +13 -0
- data/spec/models/permission_spec.rb +29 -0
- data/spec/models/theme_spec.rb +66 -0
- data/spec/spec_helper.rb +26 -0
- data/spec/support/devise.rb +3 -0
- data/spec/support/inkling_spec_helper.rb +1 -0
- metadata +222 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
<!-- <%= link_to "Add User", new_inkling_admin_user_path %> -->
|
2
|
+
<p/>
|
3
|
+
<table id="users-table">
|
4
|
+
<tr>
|
5
|
+
<th>Login</th>
|
6
|
+
<th>Roles</th>
|
7
|
+
</tr>
|
8
|
+
<% for user in @users %>
|
9
|
+
<tr>
|
10
|
+
<td><%= user.email %></td>
|
11
|
+
<td>
|
12
|
+
<% for role in user.roles %>
|
13
|
+
<%= role.name.titleize %>
|
14
|
+
<% end %>
|
15
|
+
</td>
|
16
|
+
</tr>
|
17
|
+
<% end %>
|
18
|
+
</table>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render(:partial => "form") %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<table>
|
2
|
+
<% @inkling_user.attributes.each do |a| %>
|
3
|
+
<tr>
|
4
|
+
<th><%= a[0] %></th>
|
5
|
+
<td><%= a[1] %></td>
|
6
|
+
</tr>
|
7
|
+
<% end %>
|
8
|
+
</table>
|
9
|
+
|
10
|
+
<p><%= link_to "Edit", edit_polymorphic_path(@inkling_content_types_page) %></p>
|
11
|
+
<p><%= link_to "Back", polymorphic_path(@inkling_content_types_page) %></p>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<h2>Administration</h2>
|
2
|
+
|
3
|
+
<table width=100%>
|
4
|
+
<tr>
|
5
|
+
<td width=70%><%= link_to 'Users', inkling_admin_users_path %></td>
|
6
|
+
<td width=30%><%= Inkling::User.all.size %></td>
|
7
|
+
</tr>
|
8
|
+
<tr>
|
9
|
+
<td><%= link_to 'Roles', inkling_admin_roles_path %></td>
|
10
|
+
<td><%= Inkling::Role.all.size %></td>
|
11
|
+
</tr>
|
12
|
+
<tr>
|
13
|
+
<td><%= link_to 'Workflows' %></td>
|
14
|
+
<td></td>
|
15
|
+
</tr>
|
16
|
+
<tr>
|
17
|
+
<td><%= link_to 'Types', inkling_admin_content_types_path %></td>
|
18
|
+
<td><%= Inkling::Types::Register.listed.size %></td>
|
19
|
+
</tr>
|
20
|
+
<tr>
|
21
|
+
<td><%= link_to 'Permissions', inkling_admin_permissions_path %></td>
|
22
|
+
<td><%= Inkling::Permission.all.size %></td>
|
23
|
+
</tr>
|
24
|
+
<tr>
|
25
|
+
<td><%= link_to 'Theme', edit_inkling_theme_path(Inkling::Theme.content) %></td>
|
26
|
+
<td><%= Inkling::Theme::all.size %></td>
|
27
|
+
</tr>
|
28
|
+
</table>
|
29
|
+
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<span <%= "id='content-form-#{path.id}' style='display:none, inline'" if defined? path %> >
|
2
|
+
<%= form_tag(inkling_proxy_new_path, :class => "tree-form") do %>
|
3
|
+
<%= select_tag(:content_type,
|
4
|
+
options_for_select(@content_types.collect{|c| [ c.friendly_name, c.to_s]}.insert(0, ["",""])),
|
5
|
+
:onchange=>"this.form.submit()") %>
|
6
|
+
<% end %>
|
7
|
+
</span>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<li id="<%= path.id %>" class="tree-item">
|
2
|
+
<span><%= path.content.name %> </span>
|
3
|
+
<a href="#" onclick="toggle_content_form(<%= path.id %>)">+</a>
|
4
|
+
|
5
|
+
<%= render(:partial => "content_form", :locals => {:path => path}) %>
|
6
|
+
|
7
|
+
<%= link_to 'Public View', "/inkling" + path.slug %>,
|
8
|
+
<%= link_to 'Show', polymorphic_path(path.content) %>,
|
9
|
+
<%= link_to 'Edit', edit_polymorphic_path(path.content) %>,
|
10
|
+
<%= link_to 'Delete', polymorphic_path(path.content), :method => :delete %>
|
11
|
+
|
12
|
+
<% if path.children %>
|
13
|
+
<ul>
|
14
|
+
<%= render(:partial => "path", :collection => path.children) %>
|
15
|
+
</ul>
|
16
|
+
<% end %>
|
17
|
+
</li>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div id="tree-message"></div>
|
2
|
+
|
3
|
+
<div id="content-form">
|
4
|
+
<% unless @content_types.empty? %>
|
5
|
+
<%= render(:partial => "content_form") %> (Add top level content)
|
6
|
+
<% else %>
|
7
|
+
There are no Inkling Types loaded.
|
8
|
+
<% end %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<ul id="tag-tree">
|
13
|
+
<%= render(:partial => "path", :collection => @roots) %>
|
14
|
+
</ul>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% if resource.errors.any? %>
|
2
|
+
<h2><%= pluralize(resource.errors.count, "error") %> stopped this theme from being saved:</h2>
|
3
|
+
<ul>
|
4
|
+
<% resource.errors.full_messages.each do |msg| %>
|
5
|
+
<li><%= msg %></li>
|
6
|
+
<% end %>
|
7
|
+
</ul>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% semantic_form_for [resource] do |form| %>
|
11
|
+
<%= form.input :name %>
|
12
|
+
<%= form.input :body, :input_html => {:cols => 200, :rows => 60} %>
|
13
|
+
<% form.buttons do %>
|
14
|
+
<%= form.commit_button %>
|
15
|
+
<% end %>
|
16
|
+
<% end %>
|
17
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render(:partial => "form") %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render(:partial => "form") %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render(:partial => "form") %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h2>Resend confirmation instructions</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<p><%= f.label :email %><br />
|
7
|
+
<%= f.text_field :email %></p>
|
8
|
+
|
9
|
+
<p><%= f.submit "Resend confirmation instructions" %></p>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render :partial => "devise/shared/links" %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Someone has requested a link to change your password, and you can do this through the link below.</p>
|
4
|
+
|
5
|
+
<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p>
|
6
|
+
|
7
|
+
<p>If you didn't request this, please ignore this email.</p>
|
8
|
+
<p>Your password won't change until you access the link above and create a new one.</p>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p>
|
4
|
+
|
5
|
+
<p>Click the link below to unlock your account:</p>
|
6
|
+
|
7
|
+
<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>Change your password</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
<%= f.hidden_field :reset_password_token %>
|
6
|
+
|
7
|
+
<p><%= f.label :password %><br />
|
8
|
+
<%= f.password_field :password %></p>
|
9
|
+
|
10
|
+
<p><%= f.label :password_confirmation %><br />
|
11
|
+
<%= f.password_field :password_confirmation %></p>
|
12
|
+
|
13
|
+
<p><%= f.submit "Change my password" %></p>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render :partial => "devise/shared/links" %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h2>Forgot your password?</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<p><%= f.label :email %><br />
|
7
|
+
<%= f.text_field :email %></p>
|
8
|
+
|
9
|
+
<p><%= f.submit "Send me reset password instructions" %></p>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render :partial => "devise/shared/links" %>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<p><%= f.label :email %><br />
|
7
|
+
<%= f.text_field :email %></p>
|
8
|
+
|
9
|
+
<p><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
10
|
+
<%= f.password_field :password %></p>
|
11
|
+
|
12
|
+
<p><%= f.label :password_confirmation %><br />
|
13
|
+
<%= f.password_field :password_confirmation %></p>
|
14
|
+
|
15
|
+
<p><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
16
|
+
<%= f.password_field :current_password %></p>
|
17
|
+
|
18
|
+
<p><%= f.submit "Update" %></p>
|
19
|
+
<% end %>
|
20
|
+
|
21
|
+
<h3>Cancel my account</h3>
|
22
|
+
|
23
|
+
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :confirm => "Are you sure?", :method => :delete %>.</p>
|
24
|
+
|
25
|
+
<%= link_to "Back", :back %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<h2>Sign up</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<p><%= f.label :email %><br />
|
7
|
+
<%= f.text_field :email %></p>
|
8
|
+
|
9
|
+
<p><%= f.label :password %><br />
|
10
|
+
<%= f.password_field :password %></p>
|
11
|
+
|
12
|
+
<p><%= f.label :password_confirmation %><br />
|
13
|
+
<%= f.password_field :password_confirmation %></p>
|
14
|
+
|
15
|
+
<p><%= f.submit "Sign up" %></p>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<%= render :partial => "devise/shared/links" %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h2>Sign in</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
|
4
|
+
<p><%= f.label :email %><br />
|
5
|
+
<%= f.text_field :email %></p>
|
6
|
+
|
7
|
+
<p><%= f.label :password %><br />
|
8
|
+
<%= f.password_field :password %></p>
|
9
|
+
|
10
|
+
<% if devise_mapping.rememberable? -%>
|
11
|
+
<p><%= f.check_box :remember_me %> <%= f.label :remember_me %></p>
|
12
|
+
<% end -%>
|
13
|
+
|
14
|
+
<p><%= f.submit "Sign in" %></p>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= render :partial => "devise/shared/links" %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%- if controller_name != 'sessions' %>
|
2
|
+
<%= link_to "Sign in", new_session_path(resource_name) %><br />
|
3
|
+
<% end -%>
|
4
|
+
|
5
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
6
|
+
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
7
|
+
<% end -%>
|
8
|
+
|
9
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' %>
|
10
|
+
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
11
|
+
<% end -%>
|
12
|
+
|
13
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
14
|
+
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
15
|
+
<% end -%>
|
16
|
+
|
17
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
18
|
+
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
19
|
+
<% end -%>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<h2>Resend unlock instructions</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
|
4
|
+
<%= devise_error_messages! %>
|
5
|
+
|
6
|
+
<p><%= f.label :email %><br />
|
7
|
+
<%= f.text_field :email %></p>
|
8
|
+
|
9
|
+
<p><%= f.submit "Resend unlock instructions" %></p>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<%= render :partial => "devise/shared/links" %>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Inkling Administration</title>
|
5
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
6
|
+
<meta name="keywords" content="" />
|
7
|
+
<meta name="description" content="" />
|
8
|
+
|
9
|
+
<%= stylesheet_link_tag "inkling-administration" %>
|
10
|
+
<%= csrf_meta_tag %>
|
11
|
+
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js",
|
12
|
+
"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js",
|
13
|
+
'rails.js', 'inkling.js' %>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
|
17
|
+
|
18
|
+
<div id="header">
|
19
|
+
<div id="logo">
|
20
|
+
<h1><%= link_to 'Inkling', inkling_user_root_path %></h1>
|
21
|
+
</div>
|
22
|
+
<div id="tabs">
|
23
|
+
<%= link_to 'Home', inkling_user_root_path %>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="notice"><%= notice %></div>
|
28
|
+
<div class="alert"><%= alert %></div>
|
29
|
+
|
30
|
+
<div id="page">
|
31
|
+
<div id="main">
|
32
|
+
<%= yield %>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="footer">
|
37
|
+
<span id="version" align='center'>Inkling version <%= Inkling::VERSION %></span>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<%= yield :js %>
|
41
|
+
|
42
|
+
</body>
|
43
|
+
</html>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Inkling Administration</title>
|
5
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
6
|
+
<meta name="keywords" content="" />
|
7
|
+
<meta name="description" content="" />
|
8
|
+
|
9
|
+
<%= stylesheet_link_tag "inkling-administration" %>
|
10
|
+
<%= csrf_meta_tag %>
|
11
|
+
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js",
|
12
|
+
"http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.1/jquery-ui.min.js",
|
13
|
+
'rails.js', 'inkling.js' %>
|
14
|
+
</head>
|
15
|
+
<body>
|
16
|
+
|
17
|
+
|
18
|
+
<div id="header">
|
19
|
+
<div id="logo">
|
20
|
+
<h1><%= link_to 'Inkling', inkling_user_root_path %></h1>
|
21
|
+
</div>
|
22
|
+
<div id="tabs">
|
23
|
+
<%= link_to 'Home', inkling_user_root_path %> | <%= link_to 'Tree', inkling_paths_path %>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="notice"><%= notice %></div>
|
28
|
+
<div class="alert"><%= alert %></div>
|
29
|
+
|
30
|
+
<div id="page">
|
31
|
+
<div id="main">
|
32
|
+
<%= yield %>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<div id="footer">
|
37
|
+
<span id="version" align='center'>Inkling version <%= Inkling::VERSION %></span>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<%= yield :js %>
|
41
|
+
|
42
|
+
</body>
|
43
|
+
</html>
|
data/bin/inkling
ADDED
data/config/routes.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Rails.application.routes.draw do |map|
|
2
|
+
namespace :inkling do
|
3
|
+
resources :paths, :themes
|
4
|
+
match 'update_tree' => 'paths#update_tree', :as => :update_tree
|
5
|
+
match 'proxy_new' => 'proxying#new', :as => :proxy_new
|
6
|
+
|
7
|
+
namespace :admin do
|
8
|
+
resources :users, :roles, :permissions
|
9
|
+
match 'content_types' => 'content_types#index', :as => :content_types
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
match 'home', :to => 'inkling/home#dashboard', :as => "inkling_user_root"
|
14
|
+
|
15
|
+
namespace :inkling do
|
16
|
+
devise_for "users", :controllers => { :sessions => "inkling/users/sessions", :passwords => "inkling/users/passwords", :confirmations => "inkling/users/confirmations"}, :class_name => "Inkling::User"
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
class InklingGenerator < Rails::Generators::Base
|
4
|
+
include Rails::Generators::Migration
|
5
|
+
|
6
|
+
source_root File.expand_path("../templates", __FILE__)
|
7
|
+
|
8
|
+
def self.next_migration_number(dirname)
|
9
|
+
if ActiveRecord::Base.timestamped_migrations
|
10
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
11
|
+
else
|
12
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def create_migration_file
|
17
|
+
migration_template 'create_inkling_tables.rb', 'db/migrate/create_inkling_tables.rb'
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
class CreateInklingTables < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :inkling_users do |t|
|
4
|
+
t.database_authenticatable
|
5
|
+
t.confirmable
|
6
|
+
t.recoverable
|
7
|
+
t.rememberable
|
8
|
+
t.trackable
|
9
|
+
t.timestamps
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
create_table :inkling_roles do |t|
|
14
|
+
t.string :name, :null => false
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
|
18
|
+
create_table :inkling_role_memberships do |t|
|
19
|
+
t.integer :user_id, :null => false
|
20
|
+
t.integer :role_id, :null => false
|
21
|
+
end
|
22
|
+
|
23
|
+
create_table :inkling_paths do |t|
|
24
|
+
t.integer :parent_id
|
25
|
+
t.integer :lft
|
26
|
+
t.integer :rgt
|
27
|
+
t.string :slug, :null => false
|
28
|
+
t.references :content, :polymorphic => true
|
29
|
+
t.timestamps
|
30
|
+
end
|
31
|
+
|
32
|
+
create_table :inkling_types do |t|
|
33
|
+
t.string :klass_name
|
34
|
+
t.timestamps
|
35
|
+
end
|
36
|
+
|
37
|
+
create_table :inkling_can_can_actions do |t|
|
38
|
+
t.string :name
|
39
|
+
t.timestamps
|
40
|
+
end
|
41
|
+
|
42
|
+
create_table :inkling_permissions do |t|
|
43
|
+
t.integer :type_id
|
44
|
+
t.integer :role_id, :null => false
|
45
|
+
t.integer :can_can_action_id
|
46
|
+
t.timestamps
|
47
|
+
end
|
48
|
+
|
49
|
+
create_table :inkling_themes do |t|
|
50
|
+
t.string :name, :null => false
|
51
|
+
t.text :body
|
52
|
+
t.string :extension, :null => false, :default => ".html.erb"
|
53
|
+
t.timestamps
|
54
|
+
end
|
55
|
+
|
56
|
+
# create_table :inkling_logs do |t|
|
57
|
+
# t.string :actor, :null => false
|
58
|
+
# t.integer :can_can_action_id
|
59
|
+
# t.timestamps
|
60
|
+
# end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.down
|
65
|
+
drop_table :inkling_paths
|
66
|
+
drop_table :inkling_can_can_actions
|
67
|
+
drop_table :inkling_types
|
68
|
+
drop_table :inkling_permissions
|
69
|
+
drop_table :inkling_role_memberhips
|
70
|
+
drop_table :inkling_roles
|
71
|
+
drop_table :inkling_users
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class Inkling::Ability
|
2
|
+
include CanCan::Ability
|
3
|
+
|
4
|
+
def initialize(user)
|
5
|
+
if user.has_role?(:administrator)
|
6
|
+
can :manage, :all
|
7
|
+
else
|
8
|
+
for role in user.roles
|
9
|
+
for permission in role.permissions
|
10
|
+
can permission.can_can_action.name.to_sym, permission.type.klass_name.constantize
|
11
|
+
end
|
12
|
+
end
|
13
|
+
# for role in user.roles
|
14
|
+
# role.permissions.each do |permission|
|
15
|
+
# can permission.action.to_sym, permission.path.content_type.constantize
|
16
|
+
# end
|
17
|
+
# end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Inkling
|
2
|
+
USAGE = <<END
|
3
|
+
Inkling #{Inkling::VERSION}
|
4
|
+
|
5
|
+
Usage: inkling command [ options ... ]
|
6
|
+
|
7
|
+
Options:
|
8
|
+
-?, -h, --help Print this help message
|
9
|
+
-v, --version Print the current Inkling version
|
10
|
+
-m, --template=path Use an application template that lives at path (can be a filesystem path or URL) (Not implemented)
|
11
|
+
-p, --pretend Run but do not make any changes.
|
12
|
+
--force Overwrite files that already exist.
|
13
|
+
-s, --skip Skip files that already exist.
|
14
|
+
-q, --quiet Suppress normal output.
|
15
|
+
|
16
|
+
Commands:
|
17
|
+
generate name_of_new_content_type
|
18
|
+
Generate a new blank Inkling content type
|
19
|
+
|
20
|
+
END
|
21
|
+
|
22
|
+
class Generator
|
23
|
+
attr_accessor :template_path, :pretend, :force, :skip, :quiet
|
24
|
+
|
25
|
+
def start
|
26
|
+
# Extract and save options:
|
27
|
+
options = ARGV.select{|o| o =~ /^-/ }
|
28
|
+
options.each{|o| option o }
|
29
|
+
ARGV.delete_if{|o| options.include?(o)}
|
30
|
+
|
31
|
+
# Process the command:
|
32
|
+
case cmd = ARGV.shift
|
33
|
+
when 'generate'
|
34
|
+
generate
|
35
|
+
else
|
36
|
+
puts "Inkling: command #{cmd} unknown"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def option arg
|
41
|
+
case arg
|
42
|
+
when '--help', '-h', '-?'
|
43
|
+
puts USAGE
|
44
|
+
exit(0)
|
45
|
+
when '-m', /^--template=(.*)/
|
46
|
+
template_path = $1 || ARGV.shift
|
47
|
+
when '-p', '--pretend'
|
48
|
+
pretend = true
|
49
|
+
when '--force'
|
50
|
+
force = true
|
51
|
+
when '-s', '--skip'
|
52
|
+
skip = true
|
53
|
+
when '-q', '--quiet'
|
54
|
+
quiet = true
|
55
|
+
else
|
56
|
+
puts "Inkling: option #{arg} unknown"
|
57
|
+
puts USAGE
|
58
|
+
exit(1)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def generate
|
63
|
+
puts "Generating using: #{ARGV*' '} is incomplete"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'inkling/version'
|
2
|
+
if %w(--version -v).include? ARGV.first
|
3
|
+
puts "Inkling #{Inkling::VERSION}"
|
4
|
+
exit(0)
|
5
|
+
end
|
6
|
+
|
7
|
+
ARGV << "--help" if ARGV.empty?
|
8
|
+
require 'rubygems' if ARGV.include?("--dev")
|
9
|
+
|
10
|
+
require 'inkling/commands/generator'
|
11
|
+
|
12
|
+
Inkling::Generator.new.start
|