elise 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.project +18 -0
- data/README.md +4 -0
- data/Rakefile +21 -0
- data/app/controllers/elise/account_controller.rb +34 -0
- data/app/controllers/elise/features_controller.rb +90 -0
- data/app/helpers/elise/account_helper.rb +5 -0
- data/app/helpers/elise/features_helper.rb +4 -0
- data/app/models/elise/account.rb +78 -0
- data/app/models/elise/feature.rb +9 -0
- data/app/views/elise/account/_header_menu.html.erb +24 -0
- data/app/views/elise/account/_login_form.html.erb +13 -0
- data/app/views/elise/account/index.html.erb +13 -0
- data/app/views/elise/features/index.html.erb +58 -0
- data/app/views/elise/features/new.html.erb +5 -0
- data/app/views/elise/features/show.html.erb +4 -0
- data/app/views/elise/layouts/application.html.erb +147 -0
- data/elise.gemspec +33 -0
- data/lib/application_controller.rb +27 -0
- data/lib/application_helper.rb +3 -0
- data/lib/elise.rb +26 -0
- data/lib/engine.rb +11 -0
- data/lib/rails/generators/elise/elise_generator.rb +52 -0
- data/lib/rails/generators/elise/templates/initializer.rb +8 -0
- data/lib/rails/generators/elise/templates/initializer.rb.bak +8 -0
- data/lib/rails/generators/elise/templates/migration.rb +9 -0
- data/lib/rails/generators/elise/templates/schema.rb +13 -0
- data/lib/rails/railties/tasks.rake +8 -0
- data/public/images/rails.png +0 -0
- data/test/performance/browsing_test.rb +9 -0
- data/test/test_helper.rb +13 -0
- metadata +74 -0
data/.project
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<projectDescription>
|
|
3
|
+
<name>elise</name>
|
|
4
|
+
<comment></comment>
|
|
5
|
+
<projects>
|
|
6
|
+
</projects>
|
|
7
|
+
<buildSpec>
|
|
8
|
+
<buildCommand>
|
|
9
|
+
<name>com.aptana.ide.core.unifiedBuilder</name>
|
|
10
|
+
<arguments>
|
|
11
|
+
</arguments>
|
|
12
|
+
</buildCommand>
|
|
13
|
+
</buildSpec>
|
|
14
|
+
<natures>
|
|
15
|
+
<nature>org.radrails.rails.core.railsnature</nature>
|
|
16
|
+
<nature>com.aptana.ruby.core.rubynature</nature>
|
|
17
|
+
</natures>
|
|
18
|
+
</projectDescription>
|
data/README.md
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
require 'rake/testtask'
|
|
2
|
+
|
|
3
|
+
Rake::TestTask.new do |test|
|
|
4
|
+
test.pattern = 'test/**/*_test.rb'
|
|
5
|
+
test.libs << 'test'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
begin
|
|
10
|
+
require "jeweler"
|
|
11
|
+
Jeweler::Tasks.new do |gem|
|
|
12
|
+
gem.name = "elise"
|
|
13
|
+
gem.summary = "Elise is a devise like gem witch manage users according to databaseFormalizer"
|
|
14
|
+
gem.email = "christophe.desclaux@atos.net"
|
|
15
|
+
gem.authors = ["christophe Desclaux"]
|
|
16
|
+
gem.files = Dir["{lib}/**/*", "{app}/**/*", "{public}/**/*", "{config}/**/*"]
|
|
17
|
+
end
|
|
18
|
+
Jeweler::GemcutterTasks.new
|
|
19
|
+
rescue
|
|
20
|
+
puts "Jeweler or dependency not available."
|
|
21
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Elise
|
|
2
|
+
class AccountController < ApplicationController
|
|
3
|
+
# GET /login
|
|
4
|
+
def login
|
|
5
|
+
account = Account.authenticate(params[:login], params[:password])
|
|
6
|
+
if account
|
|
7
|
+
session[:account_id] = account.id
|
|
8
|
+
session[:roleId] = account.get_roles[0].id
|
|
9
|
+
session[:roleLabel] = account.get_roles[0].label
|
|
10
|
+
redirect_to :back, :flash => { :notice => "Logged in!" }
|
|
11
|
+
else
|
|
12
|
+
redirect_to elise_url, :flash => { :error => "Invalid login or password!"}
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# GET /logout
|
|
17
|
+
def logout
|
|
18
|
+
session[:account_id] = nil
|
|
19
|
+
session[:roleId] = nil
|
|
20
|
+
session[:roleLabel] = nil
|
|
21
|
+
redirect_to :back, :flash => { :notice => "Logged out!" }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# GET /role
|
|
25
|
+
def role
|
|
26
|
+
session[:roleId] = params[:roleId]
|
|
27
|
+
session[:roleLabel] = params[:roleLabel]
|
|
28
|
+
redirect_to :back, :flash => { :notice => "Role changed!" }
|
|
29
|
+
end
|
|
30
|
+
def index
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
module Elise
|
|
2
|
+
class FeaturesController < ApplicationController
|
|
3
|
+
# GET /features
|
|
4
|
+
# GET /features.xml
|
|
5
|
+
|
|
6
|
+
def index
|
|
7
|
+
@features = Feature.all
|
|
8
|
+
|
|
9
|
+
respond_to do |format|
|
|
10
|
+
format.html # index.html.erb
|
|
11
|
+
format.xml { render :xml => @features }
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# GET /features/1
|
|
16
|
+
# GET /features/1.xml
|
|
17
|
+
def show
|
|
18
|
+
@feature = Feature.find(params[:id])
|
|
19
|
+
|
|
20
|
+
respond_to do |format|
|
|
21
|
+
format.html # show.html.erb
|
|
22
|
+
format.xml { render :xml => @feature }
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# GET /features/new
|
|
27
|
+
# GET /features/new.xml
|
|
28
|
+
def new
|
|
29
|
+
@feature = Feature.new
|
|
30
|
+
|
|
31
|
+
respond_to do |format|
|
|
32
|
+
format.html # new.html.erb
|
|
33
|
+
format.xml { render :xml => @feature }
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# GET /features/1/edit
|
|
38
|
+
def edit
|
|
39
|
+
@feature = Feature.find(params[:id])
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# POST /features
|
|
43
|
+
# POST /features.xml
|
|
44
|
+
def create
|
|
45
|
+
@feature = Feature.new(params[:feature])
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
respond_to do |format|
|
|
49
|
+
if @feature.save
|
|
50
|
+
format.html { redirect_to(@feature, :notice => 'Feature was successfully created.') }
|
|
51
|
+
format.xml { render :xml => @feature, :status => :created, :location => @feature }
|
|
52
|
+
else
|
|
53
|
+
format.html { render :action => "new" }
|
|
54
|
+
format.xml { render :xml => @feature.errors, :status => :unprocessable_entity }
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# PUT /features/1
|
|
60
|
+
# PUT /features/1.xml
|
|
61
|
+
def update
|
|
62
|
+
@feature = Feature.find(params[:id])
|
|
63
|
+
params[:elise_feature].each do |key,val|
|
|
64
|
+
map = {"rolesList" => {"roleId0000000000000" => key}}
|
|
65
|
+
if val == '1'
|
|
66
|
+
Databaseformalizer::EntitiesHelper.setAttrVals(map, @feature)
|
|
67
|
+
elsif val == '0'
|
|
68
|
+
Databaseformalizer::EntitiesHelper.removeAttrVals(map, @feature)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
respond_to do |format|
|
|
73
|
+
format.html { redirect_to(elise_features_url) }# index.html.erb
|
|
74
|
+
format.xml { render :xml => @features }
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# DELETE /features/1
|
|
79
|
+
# DELETE /features/1.xml
|
|
80
|
+
def destroy
|
|
81
|
+
@feature = Feature.find(params[:id])
|
|
82
|
+
@feature.destroy
|
|
83
|
+
|
|
84
|
+
respond_to do |format|
|
|
85
|
+
format.html { redirect_to(elise_features_url) }
|
|
86
|
+
format.xml { head :ok }
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
module Elise
|
|
2
|
+
class Account < User
|
|
3
|
+
|
|
4
|
+
attr_accessor :cur_roleId, :cur_roleLabel
|
|
5
|
+
@cur_roleId = nil
|
|
6
|
+
@cur_roleLabel = nil
|
|
7
|
+
|
|
8
|
+
def self.authenticate(login, password)
|
|
9
|
+
user = Account.all.find_all{|i| i.login == login}[0]
|
|
10
|
+
if user && user.cryptedPassword == password
|
|
11
|
+
user
|
|
12
|
+
else
|
|
13
|
+
nil
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def is_logged
|
|
18
|
+
return self.entity_def_id != nil
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def self.current_user(session)
|
|
22
|
+
if session[:account_id] != nil
|
|
23
|
+
account = Account.find(session[:account_id])
|
|
24
|
+
account.cur_roleId = session[:roleId]
|
|
25
|
+
account.cur_roleLabel = session[:roleLabel]
|
|
26
|
+
return account
|
|
27
|
+
else
|
|
28
|
+
return Account.new
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def get_roles
|
|
33
|
+
rolesList = Array.new
|
|
34
|
+
|
|
35
|
+
#check if there is one or more roles
|
|
36
|
+
if self.roleId.is_a?(String)
|
|
37
|
+
rolesList.push(Feature.find_by_id(id))
|
|
38
|
+
return rolesList
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
self.roleId.each do |id|
|
|
42
|
+
rolesList.push(Feature.find_by_id(id))
|
|
43
|
+
end
|
|
44
|
+
rolesList
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def can_see_feature(feature)
|
|
48
|
+
#check if the feature exist
|
|
49
|
+
return false if ! (defined? feature)
|
|
50
|
+
|
|
51
|
+
begin
|
|
52
|
+
#check if there is one or more roles
|
|
53
|
+
return self.cur_roleId == feature.roleId if feature.roleId.is_a?(String)
|
|
54
|
+
rescue
|
|
55
|
+
return false
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
#for array of roles
|
|
59
|
+
return feature.roleId.include?(self.cur_roleId)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def can_see_feature_name(featureName)
|
|
63
|
+
feature = Feature.find_by_label(featureName)
|
|
64
|
+
|
|
65
|
+
if feature == nil
|
|
66
|
+
#the feature doesn't exist, we can create an empty feature
|
|
67
|
+
feature = Feature.new(:label => featureName, :entity_def_id => 'Feature')
|
|
68
|
+
feature.save
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
return can_see_feature(feature)
|
|
72
|
+
end
|
|
73
|
+
def can_see(featureName)
|
|
74
|
+
return can_see_feature_name(featureName)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<li class="dropdown">
|
|
2
|
+
<% if current_user.is_logged -%>
|
|
3
|
+
<a class="btn dropdown-toggle btn-inverse" data-toggle="dropdown" href="#" id="link_user_name">
|
|
4
|
+
<i class="icon-user"></i> <%= current_user.login.titleize %> (<%= current_user.cur_roleLabel%>)
|
|
5
|
+
<span class="caret"></span>
|
|
6
|
+
</a>
|
|
7
|
+
<ul class="dropdown-menu">
|
|
8
|
+
<li> <%= link_to elise_logout_path do %><i class="icon-remove"></i> Sign Out<%end%></li>
|
|
9
|
+
<li class="divider"></li>
|
|
10
|
+
<p class="nav-header">Switch role</p>
|
|
11
|
+
<% current_user.get_roles.each do |role|%>
|
|
12
|
+
<li> <%= link_to :controller => "elise/account", :action => "role",:roleLabel => role.label,:roleId => role.id do%><i class="icon-list-alt"></i> <%= role.label%><%end%></li>
|
|
13
|
+
<% end -%>
|
|
14
|
+
</ul>
|
|
15
|
+
<% else -%>
|
|
16
|
+
<span class="navbar-form pull-right">
|
|
17
|
+
<%= form_tag 'elise/login' do %>
|
|
18
|
+
<%= text_field_tag :login, "login", :class => "span2", :onfocus => "this.value=''; this.onfocus=null;" %>
|
|
19
|
+
<%= password_field_tag :password, "********", :class => "span2", :onfocus => "this.value=''; this.onfocus=null;" %>
|
|
20
|
+
<%= submit_tag 'Log In', :id => "loginbutton", :class => "btn-primary span1" %>
|
|
21
|
+
<% end %>
|
|
22
|
+
</span>
|
|
23
|
+
<% end -%>
|
|
24
|
+
</li>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
<%= form_tag 'elise/login' do %>
|
|
3
|
+
<p>
|
|
4
|
+
<%= label_tag :login %><br />
|
|
5
|
+
<%= text_field_tag :login, params[:login] %>
|
|
6
|
+
</p>
|
|
7
|
+
<p>
|
|
8
|
+
<%= label_tag :password %><br />
|
|
9
|
+
<%= password_field_tag :password %>
|
|
10
|
+
</p>
|
|
11
|
+
<p class="button"><%= submit_tag "Log in" %></p>
|
|
12
|
+
<% end %>
|
|
13
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<h1>Log in</h1>
|
|
2
|
+
|
|
3
|
+
<% if current_user.is_logged %>
|
|
4
|
+
Logged in as <%= current_user.login %>.<hr/>
|
|
5
|
+
Switch current role<ol>
|
|
6
|
+
<% current_user.get_roles.each do |role| %>
|
|
7
|
+
<li> <%= link_to :controller => "elise/account", :action => "role",:roleLabel => role.label,:roleId => role.id do%></i> <%= role.label%><%end%></li>
|
|
8
|
+
<%end%>
|
|
9
|
+
</ol>
|
|
10
|
+
<% else %>
|
|
11
|
+
<%= render 'login_form' %>
|
|
12
|
+
<%= link_to "Sign up", elise_logout_path %>
|
|
13
|
+
<% end %>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<h1>Listing features</h1>
|
|
2
|
+
<!--https://github.com/twitter/bootstrap/issues/1935 for a on/off button -->
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
<table class="table table-bordered table-condensed table-sorter table-fixed-header">
|
|
8
|
+
<thead class="header">
|
|
9
|
+
<tr>
|
|
10
|
+
<th>label</th>
|
|
11
|
+
<%Role.all.each do |role|-%>
|
|
12
|
+
<th><%= role.label%></th>
|
|
13
|
+
<%end-%>
|
|
14
|
+
<th></th>
|
|
15
|
+
</tr>
|
|
16
|
+
</thead>
|
|
17
|
+
<tbody>
|
|
18
|
+
<% @features.each do |feature| %>
|
|
19
|
+
<tr>
|
|
20
|
+
<td><%= feature.label %></td>
|
|
21
|
+
<%Role.all.each do |role|-%>
|
|
22
|
+
<%= form_for(feature) do |f| %>
|
|
23
|
+
<% isChecked = feature.attributes.include?('roleId') && feature.roleId.include?(role.id.to_s)%>
|
|
24
|
+
<td bgcolor="<%= isChecked ? "#468847" : "#B94A48"%>"><center style="padding-top:10px">
|
|
25
|
+
<% if current_user.can_see("feature.edit")%>
|
|
26
|
+
<%= f.check_box role.id, { :checked => isChecked,:onchange => 'this.form.submit()',:autocomplete => "off"} %>
|
|
27
|
+
<%end%>
|
|
28
|
+
</center></td>
|
|
29
|
+
<%end%>
|
|
30
|
+
<%end-%>
|
|
31
|
+
<td class="td-button-menu">
|
|
32
|
+
<div class="btn-group">
|
|
33
|
+
<%= link_to 'Show', databaseformalizer_entity_path(feature), :class => 'btn btn-info btn-mini' %>
|
|
34
|
+
<% if current_user.can_see("feature.edit")%>
|
|
35
|
+
<%= link_to 'Edit', edit_databaseformalizer_entity_path(feature), :class => 'btn btn-warning btn-mini' %>
|
|
36
|
+
<%end%>
|
|
37
|
+
</div>
|
|
38
|
+
<% if current_user.can_see("feature.delete")%>
|
|
39
|
+
<%= button_to "Destroy", feature, :method=>:delete, :class=>'btn btn-danger btn-mini' %>
|
|
40
|
+
<%end%>
|
|
41
|
+
</div>
|
|
42
|
+
</td>
|
|
43
|
+
</tr>
|
|
44
|
+
<% end %>
|
|
45
|
+
</tbody>
|
|
46
|
+
</table>
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>Elise</title>
|
|
7
|
+
|
|
8
|
+
<%= javascript_include_tag(
|
|
9
|
+
"/javascripts/jquery.js",
|
|
10
|
+
"/javascripts/databaseformalizer.js",
|
|
11
|
+
"/bootstrap/js/bootstrap-transition.js",
|
|
12
|
+
"/bootstrap/js/bootstrap-alert.js",
|
|
13
|
+
"/bootstrap/js/bootstrap-modal.js",
|
|
14
|
+
"/bootstrap/js/bootstrap-dropdown.js",
|
|
15
|
+
"/bootstrap/js/bootstrap-tab.js",
|
|
16
|
+
"/bootstrap/js/bootstrap-toggle.js",
|
|
17
|
+
"/bootstrap/js/bootstrap-fixed-header.js",
|
|
18
|
+
"/bootstrap/js/bootstrap-collapse.js",
|
|
19
|
+
"/bootstrap/js/bootstrap-tooltip.js",
|
|
20
|
+
"/bootstrap/js/bootstrap-popover.js",
|
|
21
|
+
"/tablesorter/jquery.tablesorter.min.js",
|
|
22
|
+
"/tablesorter/jquery.tablesorter.js",
|
|
23
|
+
"/tablesorter/jquery.ui.datepicker.js",
|
|
24
|
+
"/jquery-ui/js/jquery-ui-1.8.21.custom.min.js",
|
|
25
|
+
"/jquery-validation/jquery.validate.min.js"
|
|
26
|
+
) %>
|
|
27
|
+
<%= csrf_meta_tag %>
|
|
28
|
+
<%= stylesheet_link_tag(
|
|
29
|
+
"/bootstrap/css/bootstrap.min.css",
|
|
30
|
+
"/stylesheets/FRM.css",
|
|
31
|
+
"/bootstrap/css/bootstrap-responsive.css",
|
|
32
|
+
"/tablesorter/style.css",
|
|
33
|
+
"/bootstrap/css/bootstrap-toggle.css",
|
|
34
|
+
"/bootstrap/css/bootstrap-fixed-header.css",
|
|
35
|
+
"/bootstrap/css/amadeus.css",
|
|
36
|
+
"/jquery-ui/css/ui-lightness/jquery-ui-1.8.21.custom.css") %>
|
|
37
|
+
</head>
|
|
38
|
+
<script language="javascript" type="text/javascript" >
|
|
39
|
+
$(document).ready(function(){
|
|
40
|
+
$('.table-fixed-header').fixedHeader();
|
|
41
|
+
});
|
|
42
|
+
</script>
|
|
43
|
+
<body>
|
|
44
|
+
<div class="navbar navbar-fixed-top">
|
|
45
|
+
<div class="navbar-inner">
|
|
46
|
+
<div class="container" style="width: auto;">
|
|
47
|
+
<ul class="nav">
|
|
48
|
+
<li class="dropdown">
|
|
49
|
+
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
|
50
|
+
<table>
|
|
51
|
+
<tr>
|
|
52
|
+
<td class="logo"></td>
|
|
53
|
+
<td>Elise
|
|
54
|
+
<br/>
|
|
55
|
+
<div class="subtitle">
|
|
56
|
+
<!-- subtitle Building requests for you -->
|
|
57
|
+
</div>
|
|
58
|
+
</td>
|
|
59
|
+
<td><b class="caret"></b></td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
62
|
+
</a>
|
|
63
|
+
<ul class="dropdown-menu">
|
|
64
|
+
<% OTHER_APPLICATIONS_URL.sort.each do |website_name, website_url|%>
|
|
65
|
+
<li>
|
|
66
|
+
<%= link_to website_name, website_url , { :target => "_blank" } %>
|
|
67
|
+
</li>
|
|
68
|
+
<% end %>
|
|
69
|
+
</ul>
|
|
70
|
+
</li>
|
|
71
|
+
</ul>
|
|
72
|
+
<ul class="nav pull-right" style="margin-top: 0px">
|
|
73
|
+
|
|
74
|
+
<%= render :partial => "elise/account/header_menu" %>
|
|
75
|
+
|
|
76
|
+
<% if current_user.can_see("databaseformalizer")%>
|
|
77
|
+
<li class="dropdown">
|
|
78
|
+
<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
|
|
79
|
+
<i class="icon-wrench"></i>Administration<span class="caret"></span>
|
|
80
|
+
</a>
|
|
81
|
+
|
|
82
|
+
<ul class="dropdown-menu">
|
|
83
|
+
<li><%= link_to "Users", users_path %></li>
|
|
84
|
+
<li><%= link_to "Access rights", elise_features_path %></li>
|
|
85
|
+
<li><%= link_to "Roles", roles_path %></li>
|
|
86
|
+
<li class="divider"></li>
|
|
87
|
+
<p class="nav-header">Databaseformalizer</p>
|
|
88
|
+
<li><%= link_to "entity def", databaseformalizer_entity_defs_path %></li>
|
|
89
|
+
<li><%= link_to "attributs def", databaseformalizer_attr_defs_path %></li>
|
|
90
|
+
<li><%= link_to "entities", databaseformalizer_entities_path %></li>
|
|
91
|
+
</ul>
|
|
92
|
+
</li>
|
|
93
|
+
<%end%>
|
|
94
|
+
</ul>
|
|
95
|
+
</div>
|
|
96
|
+
<%= render :partial => "shared/navigation" %>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
|
|
100
|
+
<div class="container-fluid">
|
|
101
|
+
<div class="row-fluid">
|
|
102
|
+
<div class="span2">
|
|
103
|
+
<div class="sidebar-nav-fixed">
|
|
104
|
+
<ul id="nav-list" class="nav nav-list">
|
|
105
|
+
<li><%= link_to "Access rights", elise_features_path %></li>
|
|
106
|
+
<li><%= link_to "Users", users_path %></li>
|
|
107
|
+
<li><%= link_to "Roles", roles_path %></li>
|
|
108
|
+
</ul>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
<div class="span10">
|
|
112
|
+
<div class="container">
|
|
113
|
+
<div class="row">
|
|
114
|
+
<div class="span10">
|
|
115
|
+
<!-- Flash Display -->
|
|
116
|
+
<% if !flash[:error].nil? %>
|
|
117
|
+
<div class="alert alert-error">
|
|
118
|
+
<a class="close" data-dismiss="alert" href="#">×</a>
|
|
119
|
+
<b>Error:</b> <span id="flash_notice"><%= flash[:error] %></span>
|
|
120
|
+
</div>
|
|
121
|
+
<% end %>
|
|
122
|
+
<% if !flash[:notice].nil? %>
|
|
123
|
+
<div class="alert alert-success">
|
|
124
|
+
<a class="close" data-dismiss="alert" href="#">×</a>
|
|
125
|
+
<b>Information:</b> <span id="flash_notice"><%= flash[:notice] %></span>
|
|
126
|
+
</div>
|
|
127
|
+
<% end %>
|
|
128
|
+
<% if !flash[:warning].nil? %>
|
|
129
|
+
<div class="alert alert-info">
|
|
130
|
+
<a class="close" data-dismiss="alert" href="#">×</a>
|
|
131
|
+
<b>Warning:</b><span id="flash_notice"> <%= flash[:warning] %></span>
|
|
132
|
+
</div>
|
|
133
|
+
<% end %>
|
|
134
|
+
<div class="visual-border">
|
|
135
|
+
<%= content_for?(:content) ? yield(:content) : yield %>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
<div class="span2">
|
|
139
|
+
<!-- Empty because we don't want the border in all the page -->
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
</div>
|
|
146
|
+
</body>
|
|
147
|
+
</html>
|
data/elise.gemspec
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Generated by jeweler
|
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
|
4
|
+
# -*- encoding: utf-8 -*-
|
|
5
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), 'lib')
|
|
6
|
+
Gem::Specification.new do |s|
|
|
7
|
+
s.name = %q{elise}
|
|
8
|
+
s.version = "0.5.0"
|
|
9
|
+
|
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
|
+
s.authors = ["Christophe Desclaux"]
|
|
12
|
+
s.date = %q{2012-05-01}
|
|
13
|
+
s.email = %q{descl@zouig.org}
|
|
14
|
+
|
|
15
|
+
s.files = `git ls-files`.split("\n")
|
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
17
|
+
s.require_paths = ["lib"]
|
|
18
|
+
|
|
19
|
+
s.rubygems_version = %q{1.3.7}
|
|
20
|
+
s.summary = %q{Elise is a devise like gem witch manage users according to databaseFormalizer}
|
|
21
|
+
|
|
22
|
+
s.homepage = "https://github.com/descl/elise"
|
|
23
|
+
|
|
24
|
+
if s.respond_to? :specification_version then
|
|
25
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
26
|
+
s.specification_version = 3
|
|
27
|
+
|
|
28
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
29
|
+
else
|
|
30
|
+
end
|
|
31
|
+
else
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
module Elise
|
|
2
|
+
## Define ControllerMethods
|
|
3
|
+
module Controller
|
|
4
|
+
extend ActiveSupport::Concern
|
|
5
|
+
included do
|
|
6
|
+
helper_method :current_user
|
|
7
|
+
before_filter :set_special_layout_elise
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def set_special_layout_elise
|
|
11
|
+
module_name = self.class.name.split("::").first
|
|
12
|
+
if module_name == 'Elise'
|
|
13
|
+
self.class.layout "elise/layouts/application"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
module InstanceMethods
|
|
18
|
+
def current_user
|
|
19
|
+
return Account.current_user(session)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
::ActionController::Base.send :include, Elise::Controller
|
|
26
|
+
|
|
27
|
+
|
data/lib/elise.rb
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Elise
|
|
2
|
+
require 'application_controller'
|
|
3
|
+
require File.expand_path('../engine', __FILE__)
|
|
4
|
+
require File.expand_path('../application_controller', __FILE__)
|
|
5
|
+
|
|
6
|
+
module Elise
|
|
7
|
+
|
|
8
|
+
end
|
|
9
|
+
def extraRoutes(map)
|
|
10
|
+
|
|
11
|
+
mount_at = '/elise'
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
map.with_options(:path_prefix => mount_at, :name_prefix => "elise_") do |t|
|
|
15
|
+
t.login "login", :controller => "elise/account", :action => "login"
|
|
16
|
+
t.logout "logout", :controller => "elise/account", :action => "logout"
|
|
17
|
+
t.role "role", :controller => "elise/account", :action => "role"
|
|
18
|
+
t.resources :features, :controller => "elise/features"
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
map.elise 'elise',
|
|
22
|
+
:action => 'index',
|
|
23
|
+
:controller => 'elise/account'
|
|
24
|
+
end
|
|
25
|
+
module_function :extraRoutes
|
|
26
|
+
end
|
data/lib/engine.rb
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
require 'rails/generators/migration'
|
|
3
|
+
|
|
4
|
+
class EliseGenerator < Rails::Generators::Base
|
|
5
|
+
include Rails::Generators::Migration
|
|
6
|
+
|
|
7
|
+
def self.source_root
|
|
8
|
+
File.join(File.dirname(__FILE__), 'templates')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.next_migration_number(dirname) #:nodoc:
|
|
12
|
+
if ActiveRecord::Base.timestamped_migrations
|
|
13
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
14
|
+
else
|
|
15
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# Every method that is declared below will be automatically executed when the generator is run
|
|
21
|
+
|
|
22
|
+
def create_migration_file
|
|
23
|
+
f = File.open File.join(File.dirname(__FILE__), 'templates', 'schema.rb')
|
|
24
|
+
schema = f.read; f.close
|
|
25
|
+
|
|
26
|
+
schema.gsub!(/ActiveRecord::Schema.*\n/, '')
|
|
27
|
+
schema.gsub!(/^end\n*$/, '')
|
|
28
|
+
|
|
29
|
+
f = File.open File.join(File.dirname(__FILE__), 'templates', 'migration.rb')
|
|
30
|
+
migration = f.read; f.close
|
|
31
|
+
migration.gsub!(/SCHEMA_AUTO_INSERTED_HERE/, schema)
|
|
32
|
+
|
|
33
|
+
tmp = File.open "tmp/~migration_ready.rb", "w"
|
|
34
|
+
tmp.write migration
|
|
35
|
+
tmp.close
|
|
36
|
+
|
|
37
|
+
migration_template '../../../tmp/~migration_ready.rb',
|
|
38
|
+
'db/migrate/create_elise_tables.rb'
|
|
39
|
+
remove_file 'tmp/~migration_ready.rb'
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def copy_initializer_file
|
|
43
|
+
copy_file 'initializer.rb', 'config/initializers/elise.rb'
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def update_application_template
|
|
47
|
+
f = File.open "app/views/layouts/application.html.erb"
|
|
48
|
+
layout = f.read; f.close
|
|
49
|
+
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
ActiveRecord::Schema.define(:version => 0) do
|
|
2
|
+
|
|
3
|
+
# create_table :databaseformalizer_widgets, :force => true do |t|
|
|
4
|
+
# t.string :title
|
|
5
|
+
# t.datetime :created_at
|
|
6
|
+
# t.datetime :updated_at
|
|
7
|
+
# end
|
|
8
|
+
#
|
|
9
|
+
# add_index :databaseformalizer_widgets, [:title]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
end
|
|
Binary file
|
data/test/test_helper.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
|
2
|
+
require File.expand_path('../../config/environment', __FILE__)
|
|
3
|
+
require 'rails/test_help'
|
|
4
|
+
|
|
5
|
+
class ActiveSupport::TestCase
|
|
6
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
|
7
|
+
#
|
|
8
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
|
9
|
+
# -- they do not yet inherit this setting
|
|
10
|
+
fixtures :all
|
|
11
|
+
|
|
12
|
+
# Add more helper methods to be used by all tests here...
|
|
13
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: elise
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.5.0
|
|
5
|
+
prerelease:
|
|
6
|
+
platform: ruby
|
|
7
|
+
authors:
|
|
8
|
+
- Christophe Desclaux
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2012-05-01 00:00:00.000000000Z
|
|
13
|
+
dependencies: []
|
|
14
|
+
description:
|
|
15
|
+
email: descl@zouig.org
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- .project
|
|
21
|
+
- README.md
|
|
22
|
+
- Rakefile
|
|
23
|
+
- app/controllers/elise/account_controller.rb
|
|
24
|
+
- app/controllers/elise/features_controller.rb
|
|
25
|
+
- app/helpers/elise/account_helper.rb
|
|
26
|
+
- app/helpers/elise/features_helper.rb
|
|
27
|
+
- app/models/elise/account.rb
|
|
28
|
+
- app/models/elise/feature.rb
|
|
29
|
+
- app/views/elise/account/_header_menu.html.erb
|
|
30
|
+
- app/views/elise/account/_login_form.html.erb
|
|
31
|
+
- app/views/elise/account/index.html.erb
|
|
32
|
+
- app/views/elise/features/index.html.erb
|
|
33
|
+
- app/views/elise/features/new.html.erb
|
|
34
|
+
- app/views/elise/features/show.html.erb
|
|
35
|
+
- app/views/elise/layouts/application.html.erb
|
|
36
|
+
- elise.gemspec
|
|
37
|
+
- lib/application_controller.rb
|
|
38
|
+
- lib/application_helper.rb
|
|
39
|
+
- lib/elise.rb
|
|
40
|
+
- lib/engine.rb
|
|
41
|
+
- lib/rails/generators/elise/elise_generator.rb
|
|
42
|
+
- lib/rails/generators/elise/templates/initializer.rb
|
|
43
|
+
- lib/rails/generators/elise/templates/initializer.rb.bak
|
|
44
|
+
- lib/rails/generators/elise/templates/migration.rb
|
|
45
|
+
- lib/rails/generators/elise/templates/schema.rb
|
|
46
|
+
- lib/rails/railties/tasks.rake
|
|
47
|
+
- public/images/rails.png
|
|
48
|
+
- test/performance/browsing_test.rb
|
|
49
|
+
- test/test_helper.rb
|
|
50
|
+
homepage: https://github.com/descl/elise
|
|
51
|
+
licenses: []
|
|
52
|
+
post_install_message:
|
|
53
|
+
rdoc_options: []
|
|
54
|
+
require_paths:
|
|
55
|
+
- lib
|
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
|
+
none: false
|
|
64
|
+
requirements:
|
|
65
|
+
- - ! '>='
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
requirements: []
|
|
69
|
+
rubyforge_project:
|
|
70
|
+
rubygems_version: 1.7.2
|
|
71
|
+
signing_key:
|
|
72
|
+
specification_version: 3
|
|
73
|
+
summary: Elise is a devise like gem witch manage users according to databaseFormalizer
|
|
74
|
+
test_files: []
|