Skip to content
Browse files

Merge branch 'master' into i18n

  • Loading branch information...
2 parents d5fb50e + 352524b commit 1f25e4585ba6800936e42c32e96dac93062e42eb Ramón Martínez Olvera committed Dec 14, 2011
Showing with 736 additions and 76 deletions.
  1. +1 −0 .gitignore
  2. +4 −4 Gemfile
  3. BIN app/assets/images/error_status.png
  4. +4 −0 app/assets/javascripts/academic.js
  5. +27 −0 app/assets/javascripts/document_academic.js
  6. +2 −1 app/coffeescripts/base.coffee
  7. +18 −0 app/coffeescripts/document_academic.coffee
  8. +31 −0 app/controllers/academic/annual_plans_controller.rb
  9. +32 −0 app/controllers/academic/annual_reports_controller.rb
  10. +16 −0 app/controllers/academic/application_controller.rb
  11. +13 −0 app/controllers/academic/sessions_controller.rb
  12. +8 −0 app/controllers/web_site/annual_plans_controller.rb
  13. +8 −0 app/controllers/web_site/annual_reports_controller.rb
  14. +20 −0 app/helpers/application_helper.rb
  15. +3 −0 app/models/academic.rb
  16. +24 −4 app/models/document.rb
  17. +1 −1 app/models/user.rb
  18. +192 −0 app/sass/academic.sass
  19. +47 −30 app/sass/application.sass
  20. +19 −20 app/sass/collection_list.sass
  21. +1 −0 app/sass/form.sass
  22. +1 −2 app/sass/publications.sass
  23. +3 −0 app/views/academic/annual_plans/_form.html.haml
  24. +7 −0 app/views/academic/annual_plans/_record.html.haml
  25. +1 −0 app/views/academic/annual_plans/approve.js.haml
  26. +6 −0 app/views/academic/annual_plans/edit.js.haml
  27. +16 −0 app/views/academic/annual_plans/index.html.haml
  28. +1 −0 app/views/academic/annual_plans/update.js.haml
  29. +3 −0 app/views/academic/annual_reports/_form.html.haml
  30. +8 −0 app/views/academic/annual_reports/_record.html.haml
  31. +1 −0 app/views/academic/annual_reports/approve.js.haml
  32. +6 −0 app/views/academic/annual_reports/edit.js.haml
  33. +17 −0 app/views/academic/annual_reports/index.html.haml
  34. +1 −0 app/views/academic/annual_reports/update.js.haml
  35. +21 −0 app/views/academic/sessions/new.html.haml
  36. +1 −1 app/views/layouts/_toplinks.html.haml
  37. +23 −0 app/views/layouts/academic.html.haml
  38. +8 −4 app/views/layouts/web_site.html.haml
  39. +1 −1 app/views/notifier/approval_request_to_user_incharge.text.erb
  40. +1 −1 app/views/notifier/rejected_document.text.erb
  41. +9 −0 app/views/web_site/annual_plans/_record.html.haml
  42. +18 −0 app/views/web_site/annual_plans/index.html.haml
  43. +9 −0 app/views/web_site/annual_reports/_record.html.haml
  44. +18 −0 app/views/web_site/annual_reports/index.html.haml
  45. +6 −0 config/academic_navigation.rb
  46. +2 −1 config/environments/production.rb
  47. +14 −3 config/initializers/devise.rb
  48. +21 −0 config/locales/es.yml
  49. +1 −1 config/routes.rb
  50. +18 −0 config/routes/academic.rb
  51. +1 −1 config/routes/base.rb
  52. +2 −1 config/routes/web_site.rb
  53. +6 −0 config/web_site_navigation.rb
  54. +9 −0 db/migrate/20111209011113_remove_old_records_from_documents.rb
  55. +5 −0 db/migrate/20111213174617_add_comments_to_documents.rb
View
1 .gitignore
@@ -80,3 +80,4 @@ app/assets/javascripts/document_publication.js
app/sass/.sass-cache/
.sass-cache/
public/assets/
+app/assets/stylesheets/academic.css
View
8 Gemfile
@@ -12,17 +12,17 @@ gem "barista", "~> 1.2.1"
gem "cancan", "1.6.7"
# Authentication
-gem "devise", "1.1.5"
-gem "devise_ldap_authenticatable"
-gem "net-ldap", "0.1.1"
+gem "devise", "~> 1.5.0"
+gem "devise_ldap_authenticatable", "~> 0.5.1"
+gem "net-ldap", "0.2.2"
# Searching and tagging
gem "tsearch", :require => "texticle"
gem "scope_by_fuzzy"
# Control version
gem "vestal_versions", "1.0.2"
-gem "simple-navigation", "3.2.0"
+gem "simple-navigation", "3.5.0"
# Misc
gem "carrierwave", "0.5.3"
View
BIN app/assets/images/error_status.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
4 app/assets/javascripts/academic.js
@@ -0,0 +1,4 @@
+//= require application
+//= require chosen.jquery.min
+//= require base
+//= require document_academic
View
27 app/assets/javascripts/document_academic.js
@@ -0,0 +1,27 @@
+/* DO NOT MODIFY. This file was compiled Tue, 13 Dec 2011 19:56:19 GMT from
+ * /Users/alex/Projects/Rails/salva/app/coffeescripts/document_academic.coffee
+ */
+
+
+ $(document).ready(function() {
+ $(".approve_document").live("click", function(e) {
+ var html;
+ e.preventDefault();
+ html = $.response_from_remote_resource(this.href);
+ $(this).parent().parent().replaceWith(html);
+ return false;
+ });
+ $(".reject_document").live("click", function(e) {
+ e.preventDefault();
+ return $.dialog_for_new_record(this.href);
+ });
+ return $(".simple_form").live("submit", function() {
+ var dom_id;
+ dom_id = $(".simple_form").attr("id");
+ return $(".simple_form").ajaxComplete(function(event, request, settings) {
+ $("#dialog").empty();
+ $("#dialog").dialog("close");
+ return $("#" + dom_id).replaceWith(request.responseText);
+ });
+ });
+ });
View
3 app/coffeescripts/base.coffee
@@ -79,14 +79,15 @@ jQuery.extend
$.ajax(options).responseText
dialog_for_new_record: (controller) ->
+ controller += ".js" if (controller.match(/format\=js$/g) == null)
$("#dialog").dialog(
title: ""
width: 400
height: 330
modal: true
overlay: background: "#fff", opacity: 0.25
).dialog "open"
- responseData = $.response_from_simple_remote_resource(controller + ".js")
+ responseData = $.response_from_simple_remote_resource(controller)
$("div#dialog").html responseData
dialog_for_new_checkbox: (controller) ->
View
18 app/coffeescripts/document_academic.coffee
@@ -0,0 +1,18 @@
+$(document).ready ->
+ $(".approve_document").live "click", (e) ->
+ e.preventDefault()
+ html = $.response_from_remote_resource(this.href)
+ $(this).parent().parent().replaceWith(html)
+ false
+
+ $(".reject_document").live "click", (e) ->
+ e.preventDefault()
+ $.dialog_for_new_record(this.href)
+
+ $(".simple_form").live "submit", ->
+ dom_id = $(".simple_form").attr("id")
+ $(".simple_form").ajaxComplete (event, request, settings) ->
+ $("#dialog").empty()
+ $("#dialog").dialog "close"
+ $("#"+dom_id).replaceWith(request.responseText)
+
View
31 app/controllers/academic/annual_plans_controller.rb
@@ -0,0 +1,31 @@
+class Academic::AnnualPlansController < Academic::ApplicationController
+ respond_to :js, :html
+
+ def index
+ respond_with(@documents = Document.annual_plans.where(:approved_by_id => current_user.id).paginate(:per_page => 10, :page => params[:page] || 1))
+ end
+
+ def approve
+ authorize_action!
+ respond_with(@document.approve)
+ end
+
+ def edit
+ authorize_action!
+ respond_with(@document)
+ end
+
+ def update
+ authorize_action!
+ @document.update_attributes(params[:document])
+ @document.reject
+ respond_with(@document)
+ end
+
+ def authorize_action!
+ @document = Document.find(params[:id])
+ unless @document.approved_by_id == current_user.id
+ authorize! :read, Document, :message => "Unable to approve or reject this document."
+ end
+ end
+end
View
32 app/controllers/academic/annual_reports_controller.rb
@@ -0,0 +1,32 @@
+class Academic::AnnualReportsController < Academic::ApplicationController
+ respond_to :js, :html
+
+ def index
+ respond_with(@documents = Document.annual_reports.where(:approved_by_id => current_user.id).paginate(:per_page => 10, :page => params[:page] || 1))
+ end
+
+ def approve
+ authorize_action!
+ @document.approve
+ respond_with(@document)
+ end
+
+ def edit
+ authorize_action!
+ respond_with(@document)
+ end
+
+ def update
+ authorize_action!
+ @document.update_attributes(params[:document])
+ @document.reject
+ respond_with(@document)
+ end
+
+ def authorize_action!
+ @document = Document.find(params[:id])
+ unless @document.approved_by_id == current_user.id
+ authorize! :read, Document, :message => "Unable to approve or reject this document."
+ end
+ end
+end
View
16 app/controllers/academic/application_controller.rb
@@ -0,0 +1,16 @@
+class Academic::ApplicationController < ActionController::Base
+ protect_from_forgery
+ skip_before_filter :authenticate_user!
+ before_filter :authenticate_academic!
+ alias :current_user :current_academic
+
+ layout :layout_by_resource
+
+ def layout_by_resource
+ if devise_controller?
+ "devise"
+ else
+ "academic"
+ end
+ end
+end
View
13 app/controllers/academic/sessions_controller.rb
@@ -0,0 +1,13 @@
+class Academic::SessionsController < ::Devise::SessionsController
+ skip_before_filter :authenticate_user!, :only => [:create, :new]
+ layout "devise"
+
+ def create
+ resource = warden.authenticate!(:scope => resource_name, :recall => "academic/sessions#new")
+ set_flash_message(:notice, :signed_in) if is_navigational_format?
+ sign_in(resource_name, resource)
+ respond_with resource, :location => academic_annual_reports_path
+ end
+end
+
+
View
8 app/controllers/web_site/annual_plans_controller.rb
@@ -0,0 +1,8 @@
+class WebSite::AnnualPlansController < WebSite::ApplicationController
+ respond_to :html, :js
+
+ def index
+ @documents = Document.annual_plans.fullname_asc.search(params[:search]).paginate(:per_page => params[:per_page] || 30, :page => params[:page] || 1)
+ respond_with(@documents)
+ end
+end
View
8 app/controllers/web_site/annual_reports_controller.rb
@@ -0,0 +1,8 @@
+class WebSite::AnnualReportsController < WebSite::ApplicationController
+ respond_to :html, :js
+
+ def index
+ @documents = Document.annual_reports.fullname_asc.search(params[:search]).paginate(:per_page => params[:per_page] || 30, :page => params[:page] || 1)
+ respond_with(@documents)
+ end
+end
View
20 app/helpers/application_helper.rb
@@ -184,4 +184,24 @@ def updating_date(record)
def select_month_for(field_name, prefix = nil)
select_month(Date.today, {:field_name => field_name, :prefix => prefix}, :class => 'chosen-select')
end
+
+ def document_status_indicator(status)
+ if status == true
+ image_tag('associated_record.png', :class => 'associated_record_indicator', :title => t(:approved))
+ else
+ image_tag('error_status.png', :class => 'associated_record_indicator', :title => t(:rejected))
+ end
+ end
+
+ def link_to_approve_document(record, resource_path)
+ if record.documenttype.status == true
+ link_to t(:approve), resource_path, :remote => true, :class => 'approve_document', :confirm => t(:approve_document_approbation)
+ end
+ end
+
+ def link_to_reject_document(record, resource_path)
+ if record.documenttype.status == true
+ link_to t(:reject), resource_path, :remote => true, :class => 'reject_document'
+ end
+ end
end
View
3 app/models/academic.rb
@@ -0,0 +1,3 @@
+class Academic < User
+
+end
View
28 app/models/document.rb
@@ -5,10 +5,17 @@ class Document < ActiveRecord::Base
belongs_to :documenttype
belongs_to :approved_by, :class_name => 'User'
- default_scope :order => 'documenttypes.start_date DESC, documenttypes.end_date DESC', :joins => :documenttype
+ default_scope :order => 'documenttypes.start_date DESC, documenttypes.end_date DESC', :joins => :documenttype, :readonly => false
+
+ scope :fullname_asc, joins(:user=>:person).order('people.lastname1 ASC, people.lastname2 ASC, people.firstname ASC')
scope :annual_reports, joins(:documenttype).where("documenttypes.name LIKE 'Informe anual de actividades%'")
scope :annual_plans, joins(:documenttype).where("documenttypes.name LIKE 'Plan de trabajo%'")
+ scope :fullname_like, lambda { |fullname| where(" documents.user_id IN (#{Person.find_by_fullname(fullname).select('user_id').to_sql}) ") }
+ scope :adscription_id_eq, lambda { |adscription_id| joins(:user=> :user_adscriptions).where(["user_adscriptions.adscription_id = ?", adscription_id] ) }
+
+ search_methods :fullname_like, :adscription_id_eq
+
before_create :file_path
def url
@@ -22,7 +29,20 @@ def file_path
elsif !documenttype.name.match(/^Plan de trabajo/).nil?
path += '/annual_plans/' + documenttype.year.to_s
end
- system "mkdir -p #{path}" unless File.exist? path
- self.file = path + "/#{user.login}.pdf"
- end
+ system "mkdir -p #{path}" unless File.exist? path
+
+ unless user.nil?
+ self.file = path + "/#{user.login}.pdf"
+ else
+ self.file.to_s
+ end
+ end
+
+ def approve
+ update_attribute(:approved, true)
+ end
+
+ def reject
+ update_attribute(:approved, false)
+ end
end
View
2 app/models/user.rb
@@ -5,7 +5,7 @@ class User < ActiveRecord::Base
if ldap_enabled?
devise :ldap_authenticatable, :timeoutable, :lockable
else
- devise :database_authenticatable, :encryptable, :timeoutable, :lockable
+ devise :database_authenticatable, :timeoutable, :lockable
end
# Setup accessible (or protected) attributes for your model
View
192 app/sass/academic.sass
@@ -0,0 +1,192 @@
+@import "base"
+@import "blueprint"
+@import "start-jquery-ui"
+@import "form"
+
+#session_info
+ @extend .ui-button-set
+ @extend .span-24
+ @extend .last
+ text-align: right
+ .current_user
+ color: green
+ display: inline
+
+#top-navigation
+ @extend .span-24
+ @extend .last
+ font-size: 14px
+ text-align: left
+ height: 30px
+ margin-top: 10px
+ //border: 1px solid red
+ ul
+ @extend .ui-tabs-nav
+ @extend .ui-helper-reset
+ @extend .ui-helper-clearfix
+ @extend .span-24
+ display: inline-block
+ margin-left: -4px
+ vertical-align: middle
+ li
+ @extend .ui-state-default
+ @extend .ui-corner-all
+ list-style-type: none
+ padding-top: 7px
+ padding-left: 3px
+ padding-right: 3px
+ margin-left: 2px
+ background: #0088BB
+ line-height: 1.01em
+ height: 30px
+ width: 200px
+ float: left
+ text-align: center
+ vertical-align: middle
+ a
+ display: inline-block
+ vertical-align: middle
+
+ li.selected
+ @extend .ui-tabs-selected
+ @extend .ui-state-active
+ border-right: 0px
+ margin-top: 0px
+ li:hover
+ @extend .ui-state-hover
+
+#content
+ @extend .span-24
+ @extend .last
+ background: #fff
+ font-size: 11px
+ margin-top: 10px
+ margin-left: -3px
+ margin-bottom: 20px
+ padding-top: 20px
+ text-align: left
+h3
+ color: #6EAC2C
+ text-shadow: rgb(143,191,92) 1px 1px 3px
+ font-size: 160%
+
+.row
+ @extend .span-24
+ @extend .last
+ .wrapper
+ @extend .span-5
+ strong
+ font: 14px Arial,sans-serif
+ font-weight: bold
+ text-align: justify
+ color: rgb(0, 136, 187)
+
+ .new_record
+ vertical-align: middle
+ margin-top: 20px
+ margin-left: 3px
+ @extend .ui-state-default
+
+
+.wrapper
+ strong
+ font: 14px Arial,sans-serif
+ font-weight: bold
+ text-align: justify
+ color: rgb(0, 136, 187)
+
+.record
+ padding-top: 8px
+ padding-bottom: 8px
+ min-height: 60px
+ border-bottom: 1px solid silver
+ vertical-align: middle
+
+.record-odd
+ @extend .record
+ background-color: #fff
+ color: #585858
+
+.record-odd:hover
+ background-color: #CEF6CE
+
+.record-even
+ @extend .record
+ background: #EFF5FB
+ color: #585858
+
+.record-even:hover
+ background-color: #CEF6CE
+
+#paginator
+ display: block
+ height: 30px
+
+.pagination
+ @extend .span-20
+ @extend .last
+ text-align: center
+ margin-botom: 5px
+
+.ui-progressbar-value
+ background-image: url(pbar-ani.gif)
+
+
+.collection_header_colors
+ background: #f5f5f5
+ color: #0088bb
+ font-weight: bold
+ padding-left: 3px
+
+
+#filter_form
+ @extend .ui-widget-header
+ @extend .ui-helper-clearfix
+ @extend .span-24
+ @extend .last
+ @extend .collection_header_colors
+ border-color: silver
+ padding-bottom: 5px
+ ul
+ color: #585858
+ .chzn-single
+ color: #585858
+
+#collection_header
+ @extend .ui-widget-header
+ @extend .ui-helper-clearfix
+ @extend .span-24
+ @extend .last
+ @extend .collection_header_colors
+ border-style: solid
+ border-color: silver
+ background: #f5f5f5
+ .action
+ @extend .span-2
+ text-align: center
+
+#collection_records
+ @extend .span-24
+ @extend .last
+ border-left: 1px solid silver
+ border-right: 1px solid silver
+ text-align: left
+ padding-left: 3px
+ min-height: 60px
+
+#collection_footer
+ @extend .ui-widget-header
+ @extend .ui-helper-clearfix
+ @extend .span-24
+ @extend .last
+ @extend .collection_header_colors
+ border-top: 0px
+ text-align: right
+ padding: 5px 0px 5px 0px
+ margin-bottom: 10px
+ padding-left: 3px
+ border-top: 0px
+ border-left: 1px solid silver
+ border-right: 1px solid silver
+ border-bottom: 1px solid silver
+
View
77 app/sass/application.sass
@@ -10,49 +10,65 @@
text-align: left
height: 42px
margin-top: 10px
- //border: 1px solid red
ul
- @extend .ui-tabs-nav
- @extend .ui-helper-reset
- @extend .ui-helper-clearfix
@extend .span-24
display: inline-block
margin-left: -4px
vertical-align: middle
li
- @extend .ui-state-default
- @extend .ui-corner-top
list-style-type: none
padding-top: 7px
padding-left: 3px
padding-right: 3px
- margin-left: 2px
- background: #0088BB
+ margin-left: 0px
line-height: 1.01em
height: 42px
width: 84px
float: left
text-align: center
vertical-align: middle
- a
- display: inline-block
- vertical-align: middle
+ border-bottom: 1px solid silver
+
+ a, a:visited
+ display: inline-block
+ vertical-align: middle
+ text-decoration: none
+ color: #0088BB
+
+ a:hover
+ display: inline-block
+ vertical-align: middle
+ text-decoration: none
+ color: #6EAC2C
+ text-shadow: rgb(143,191,92) 1px 1px 3px
li.selected
- @extend .ui-tabs-selected
- @extend .ui-state-active
border-right: 0px
margin-top: 0px
- li:hover
- @extend .ui-state-hover
+ background: white
+ border-top: 1px
+ border-bottom: 0px
+ border-left: 1px
+ border-right: 1px
+ border-style: solid
+ border-color: silver
+ -moz-border-radius: 3px 3px 0px 0px
+ -webkit-border-radius: 3px 3px 0px 0px
+
+ a
+ display: inline-block
+ vertical-align: middle
+ text-decoration: none
+ color: #6EAC2C
+ text-shadow: rgb(143,191,92) 1px 1px 3px
+ font-weight: bold
#content
@extend .span-24
@extend .last
width: 930px
background: #fff
font-size: 11px
- // border: 5px solid #93c355
margin-top: 10px
margin-left: -3px
margin-bottom: 20px
@@ -71,32 +87,32 @@
@extend .ui-helper-clearfix
margin-top: 10px
li
- @extend .ui-state-default
padding: 12px 8px
list-style-type: none
- background: #0088BB
- border-bottom-left-radius: 5px
+ background: white
+ color: #0088BB
+ border-radius: 5px
border-color: #F4FCF2
border-style: solid
- border-top-left-radius: 5px
- border-right: none
- border-left:none
border-bottom: 1px
margin-bottom: 6px
margin-left: 8px
padding-top: -8px
height: 18px
- a
+ a, a:visited
display: inline-block
width: 165px
#padding-right: 20px
+ color: #0088BB
+ text-decoration: none
+ a:hover
+ text-decoration: none
+ color: #6EAC2C
+
li.selected
+ @extend .ui-state-default
@extend .ui-tabs-selected
@extend .ui-state-active
- border-right: none
-
- li:hover
- @extend .ui-state-hover
#right-content
@extend .span-18
@@ -105,9 +121,10 @@
padding-top: 10px
padding-bottom: 10px
font-size: 14px
- // border-left: 5px solid #93c355
- margin-left: 10px
- padding-left: 9px
+ border-left: 1px solid silver
+ margin-left: 0px
+ padding-left: 15px
+ margin-top: 10px
min-height: 950px
h3
View
39 app/sass/collection_list.sass
@@ -39,15 +39,15 @@
color: #585858
.record-odd:hover
- background-color: #CEF6CE
+ background-color: rgb(252,255,204)
.record-even
@extend .record
background: #EFF5FB
color: #585858
.record-even:hover
- background-color: #CEF6CE
+ background-color: rgb(252,255,204)
.ui-autocomplete-loading
background: white url("loading_indicator.gif") right center no-repeat
@@ -65,7 +65,6 @@
.ui-progressbar-value
background-image: url(pbar-ani.gif)
-
.record_details
top: 20px
padding: 10px
@@ -80,28 +79,22 @@
margin-left: 5px
.collection_header_colors
- background: rgb(161,216,241)
+ background: #f5f5f5
color: #0088bb
- font-weight: normal
+ font-weight: bold
padding-left: 3px
-#table_search_form
- @extend .ui-widget-header
- @extend .ui-corner-tl
- @extend .ui-corner-tr
- @extend .ui-helper-clearfix
- @extend .span-18
- @extend .last
- @extend .collection_header_colors
#filter_form
@extend .ui-widget-header
- @extend .ui-corner-tl
- @extend .ui-corner-tr
@extend .ui-helper-clearfix
@extend .span-18
@extend .last
+ @extend .ui-corner-tl
+ @extend .ui-corner-tr
@extend .collection_header_colors
+ padding-top: 5px
+ border-color: silver
padding-bottom: 5px
ul
color: #585858
@@ -114,34 +107,40 @@
@extend .span-18
@extend .last
@extend .collection_header_colors
+ border-style: solid
+ border-color: silver
border-top: 0px
+ background: #f5f5f5
.action
@extend .span-2
text-align: center
#collection_records
@extend .span-18
@extend .last
- border-left: 1px solid #30a3d7
- border-right: 1px solid #30a3d7
- border-bottom: 1px solid #30a3d7
+ border-left: 1px solid silver
+ border-right: 1px solid silver
text-align: left
padding-left: 3px
min-height: 60px
#collection_footer
@extend .ui-widget-header
- @extend .ui-corner-bl
- @extend .ui-corner-br
@extend .ui-helper-clearfix
@extend .span-18
@extend .last
+ @extend .ui-corner-bl
+ @extend .ui-corner-br
@extend .collection_header_colors
border-top: 0px
text-align: right
padding: 5px 0px 5px 0px
margin-bottom: 10px
padding-left: 3px
+ border-top: 0px
+ border-left: 1px solid silver
+ border-right: 1px solid silver
+ border-bottom: 1px solid silver
.chosen-select
color: #585858
View
1 app/sass/form.sass
@@ -53,6 +53,7 @@ input[type="submit"]
.collection_radio
font-weight: normal
+ color: black
.simple_select
width: 350px
View
3 app/sass/publications.sass
@@ -4,7 +4,7 @@
#nav_links
@extend .span-18
@extend .last
- text-align: left
+ text-align: right
margin-bottom: 10px
a
@@ -13,7 +13,6 @@
height: 23px
display: inline-block
vertical-align: middle
- border-right: 1px solid #6EAC2C
padding-right: 10px
margin-right: 5px
View
3 app/views/academic/annual_plans/_form.html.haml
@@ -0,0 +1,3 @@
+.dialog-section-with-border-and-bg
+ .row
+ = f.input :comments, :as => :text, :input_html => { :size => '38x3' }
View
7 app/views/academic/annual_plans/_record.html.haml
@@ -0,0 +1,7 @@
+.row{:id => dom_id(record), :class => cycle('record-odd', 'record-even')}
+ .span-5= record.user.fullname_or_email
+ .span-5= record.documenttype.name
+ .span-2= document_status_indicator(record.approved)
+ .span-2= link_to_download(record)
+ .span-2= link_to_approve_document record, approve_academic_annual_plan_path(:id => record.id, :format => :js)
+ .span-2.last= link_to_reject_document record, edit_academic_annual_plan_path(:id => record.id, :format => :js)
View
1 app/views/academic/annual_plans/approve.js.haml
@@ -0,0 +1 @@
+= render :partial => 'record', :locals => { :record => @document }
View
6 app/views/academic/annual_plans/edit.js.haml
@@ -0,0 +1,6 @@
+%h3=t('.title')
+= simple_form_for(@document, :remote => true, :url => academic_annual_plan_path(@document),
+ :html => {:id => dom_id(@document)}) do |f|
+ = render :partial => 'form', :locals => { :f => f}
+ #dialog_submit_buttons
+ = f.submit t(:reject), :confirm => t(:reject_document_confirmation)
View
16 app/views/academic/annual_plans/index.html.haml
@@ -0,0 +1,16 @@
+%h3= t('.title')
+
+#collection_header
+ .span-5=t(:fullname)
+ .span-5=t(:document)
+ .span-2=t(:status)
+ .span-2=t(:download)
+ .span-2=t(:approve)
+ .span-2.last=t(:reject)
+
+#collection_records
+ = render :partial => 'record', :collection => @documents
+
+#collection_footer
+
+= will_paginate(@documents)
View
1 app/views/academic/annual_plans/update.js.haml
@@ -0,0 +1 @@
+= render :partial => 'record', :locals => { :record => @document }
View
3 app/views/academic/annual_reports/_form.html.haml
@@ -0,0 +1,3 @@
+.dialog-section-with-border-and-bg
+ .row
+ = f.input :comments, :as => :text, :input_html => { :size => '38x3' }
View
8 app/views/academic/annual_reports/_record.html.haml
@@ -0,0 +1,8 @@
+.row{:id => dom_id(record), :class => cycle('record-odd', 'record-even')}
+ .span-5= record.user.fullname_or_email
+ .span-5= record.documenttype.name
+ .span-2= document_status_indicator(record.approved)
+ .span-2= link_to_download(record)
+ .span-2= link_to_approve_document record, approve_academic_annual_report_path(:id => record.id, :format => :js)
+ .span-2.last= link_to_reject_document record, edit_academic_annual_report_path(:id => record.id, :format => :js)
+
View
1 app/views/academic/annual_reports/approve.js.haml
@@ -0,0 +1 @@
+= render :partial => 'record', :locals => { :record => @document }
View
6 app/views/academic/annual_reports/edit.js.haml
@@ -0,0 +1,6 @@
+%h3=t('.title')
+= simple_form_for(@document, :remote => true, :url => academic_annual_report_path(@document),
+ :html => {:id => dom_id(@document)}) do |f|
+ = render :partial => 'form', :locals => { :f => f}
+ #dialog_submit_buttons
+ = f.submit t(:reject), :confirm => t(:reject_document_confirmation)
View
17 app/views/academic/annual_reports/index.html.haml
@@ -0,0 +1,17 @@
+%h3= t('.title')
+
+#collection_header
+ .span-5=t(:fullname)
+ .span-5=t(:document)
+ .span-2=t(:status)
+ .span-2=t(:download)
+ .span-2=t(:approve)
+ .span-2.last=t(:reject)
+
+#collection_records
+ = render :partial => 'record', :collection => @documents
+
+#collection_footer
+
+= will_paginate(@documents)
+
View
1 app/views/academic/annual_reports/update.js.haml
@@ -0,0 +1 @@
+= render :partial => 'record', :locals => { :record => @document }
View
21 app/views/academic/sessions/new.html.haml
@@ -0,0 +1,21 @@
+#login_view
+ #login_form
+ %h3 Inicio de sesión
+ = simple_form_for(resource, :as => resource_name, :url => academic_session_path(resource) ) do |f|
+ = f.label :login
+ = f.text_field :login, :size => 16, :maxlength => 16
+ = f.label :password
+ = f.password_field :password, :size => 16, :maxlength => 16
+
+ #submit_buttons
+ = f.button :submit, "Sign in"
+ #login_info
+ %p= 'Para entrar al sistema debes usar el usuario y contraseña del correo electrónico del Instituto de Física.'
+ %p= 'Por ejemplo, si tu cuenta de correo es <em>sandovalv@fisica.unam.mx</em> los datos para entrar al sistema son:'.html_safe
+ #login_example
+ %b='Usuario: '
+ = 'sandovalv'
+ %br
+ %b='Contraseña: '
+ = '*'*8
+= render :partial => 'devise/sessions/supported_browser_links'
View
2 app/views/layouts/_toplinks.html.haml
@@ -2,4 +2,4 @@
#session_info
.current_user= current_user.login
= '|'
- = link_to 'Salir', destroy_user_session_path
+ = link_to 'Salir', destroy_user_session_path, :method => :delete
View
23 app/views/layouts/academic.html.haml
@@ -0,0 +1,23 @@
+!!!
+%html
+ %head
+ %title= 'Plataforma de Información Curricular - SALVA'
+ = csrf_meta_tag
+ = render :partial => 'layouts/blueprint_css'
+ = stylesheet_link_tag 'academic'
+ = javascript_include_tag 'academic'
+
+ %body
+ = render :partial => 'layouts/header'
+ .container
+ - unless current_user.nil?
+ #session_info
+ .current_user= current_user.login
+ = '|'
+ = link_to 'Salir', destroy_academic_session_path, :method => :delete
+ #top-navigation= render_navigation(:context => :academic)
+ #content
+ = render :partial => 'layouts/flash_messages'
+ = yield
+ #dialog
+ = render :partial => 'layouts/footer'
View
12 app/views/layouts/web_site.html.haml
@@ -2,13 +2,17 @@
%html
%head
%title= 'Plataforma de Información Curricular - SALVA'
+ = csrf_meta_tag
= render :partial => 'layouts/blueprint_css'
- = stylesheet_link_tag 'web_site'
- // = javascript_include_tag :defaults
+ = stylesheet_link_tag 'academic'
+ = javascript_include_tag 'academic'
%body
= render :partial => 'layouts/header'
.container
- = yield
+ #top-navigation= render_navigation(:context => :web_site)
+ #content
+ = render :partial => 'layouts/flash_messages'
+ = yield
#dialog
- = render :partial => 'layouts/footer'
+ = render :partial => 'layouts/footer'
View
2 app/views/notifier/approval_request_to_user_incharge.text.erb
@@ -7,7 +7,7 @@ Usted ha recibido una solicitud para aprobar el <%= @document.documenttype.name
de <%= @document.user.fullname_or_email %>, revise la lista de documentos por
aprobar en la siguiente liga:
-academic_documents_path
+<%= new_academic_session_path %>
Gracias por usar la Plataforma de Información Curricular - SALVA.
View
2 app/views/notifier/rejected_document.text.erb
@@ -9,7 +9,7 @@ NO fue *aprobado* por su responsable académico.
A continuación se incluye un mensaje de su responsable académico:
======================================================================
-<%= @document.comment %>
+<%= @document.comments %>
======================================================================
View
9 app/views/web_site/annual_plans/_record.html.haml
@@ -0,0 +1,9 @@
+.row{:id => dom_id(record), :class => cycle('record-odd', 'record-even')}
+ .span-4= record.user.fullname_or_email
+ .span-4= record.approved_by.nil? ? "-" : record.approved_by.fullname_or_email
+ .span-4= record.documenttype.name
+ .span-4= record.created_on.to_s(:format => :short)
+ .span-4= record.updated_on.to_s(:format => :short)
+ .span-2= document_status_indicator(record.approved)
+ .span-2.last= link_to_download(record)
+
View
18 app/views/web_site/annual_plans/index.html.haml
@@ -0,0 +1,18 @@
+%h3= t('.title')
+
+#collection_header
+ .span-4=t(:fullname)
+ .span-4=t(:academic_responsible)
+ .span-4=t(:document_type)
+ .span-4=t(:deliver_date)
+ .span-4=t(:authorization_date)
+ .span-2=t(:status)
+ .span-2.last=t(:download)
+
+#collection_records
+ = render :partial => 'record', :collection => @documents
+
+#collection_footer
+
+= will_paginate(@documents)
+
View
9 app/views/web_site/annual_reports/_record.html.haml
@@ -0,0 +1,9 @@
+.row{:id => dom_id(record), :class => cycle('record-odd', 'record-even')}
+ .span-4= record.user.fullname_or_email
+ .span-4= record.approved_by.nil? ? "-" : record.approved_by.fullname_or_email
+ .span-4= record.documenttype.name
+ .span-4= record.created_on.to_s(:format => :short)
+ .span-4= record.updated_on.to_s(:format => :short)
+ .span-2= document_status_indicator(record.approved)
+ .span-2.last= link_to_download(record)
+
View
18 app/views/web_site/annual_reports/index.html.haml
@@ -0,0 +1,18 @@
+%h3= t('.title')
+
+#collection_header
+ .span-4=t(:fullname)
+ .span-4=t(:academic_responsible)
+ .span-4=t(:document_type)
+ .span-4=t(:deliver_date)
+ .span-4=t(:authorization_date)
+ .span-2=t(:status)
+ .span-2.last=t(:download)
+
+#collection_records
+ = render :partial => 'record', :collection => @documents
+
+#collection_footer
+
+= will_paginate(@documents)
+
View
6 config/academic_navigation.rb
@@ -0,0 +1,6 @@
+SimpleNavigation::Configuration.run do |navigation|
+ navigation.items do |primary|
+ primary.item :annual_reports, 'Informes anuales', academic_annual_reports_path
+ primary.item :annual_plans, 'Planes de trabajo', academic_annual_plans_path
+ end
+end
View
3 config/environments/production.rb
@@ -50,7 +50,8 @@
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
# config.assets.precompile += %w( search.js )
config.assets.precompile += %w( screen.css print.css ie.css devise.css devise.js user_resources.css
- user_resources.js publications.css publications.js )
+ user_resources.js publications.css publications.js academic.css
+ academic.js)
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
View
17 config/initializers/devise.rb
@@ -32,6 +32,8 @@
# parameters are used only when authenticating and not when retrieving from
# session. If you need permissions, you should implement that in a before filter.
config.authentication_keys = [ :login ]
+ config.case_insensitive_keys = [ :login ]
+ config.strip_whitespace_keys = [ :login, :password, :email ]
# Tell if authentication through request.params is enabled. True by default.
# config.params_authenticatable = true
@@ -48,7 +50,7 @@
# ==> Configuration for :database_authenticatable
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
# using other encryptors, it sets how many times you want the password re-encrypted.
- config.stretches = 10
+ config.stretches = Rails.env.test? ? 1 : 10
# Define which will be the encryption algorithm. Devise also supports encryptors
# from others authentication tools as :clearance_sha1, :authlogic_sha512 (then
@@ -109,6 +111,7 @@
# Time interval to unlock the account if :time is enabled as unlock_strategy.
config.unlock_in = 2.hour
+ config.reset_password_within = 2.hours
# ==> Configuration for :token_authenticatable
# Defines name of the authentication token params key
@@ -122,12 +125,19 @@
# Configure the default scope given to Warden. By default it's the first
# devise role declared in your routes.
- # config.default_scope = :user
+ config.default_scope = :user
# Configure sign_out behavior.
# By default sign_ou t is scoped (i.e. /users/sign_out affects only :user scope).
# In case of sign_out_all_scopes set to true any logout action will sign out all active scopes.
- # config.sign_out_all_scopes = false
+ config.sign_out_all_scopes = false
+
+ # The default HTTP method used to sign out a resource. Default is :delete.
+ config.sign_out_via = :delete
+
+ # If true, uses the password salt as remember token. This should be turned
+ # to false if you are not using database authenticatable.
+ config.use_salt_as_remember_token = true
# ==> Navigation configuration
# Lists the formats that should be treated as navigational. Formats like
@@ -136,6 +146,7 @@
# If you have any extra navigational formats, like :iphone or :mobile, you
# should add them to the navigational formats lists. Default is [:html]
# config.navigational_formats = [:html, :iphone]
+ config.navigational_formats = [:"*/*", "*/*", :html]
# ==> Warden configuration
# If you want to use other strategies, that are not (yet) supported by Devise,
View
21 config/locales/es.yml
@@ -1617,6 +1617,11 @@ es:
password: Nueva contraseña
password_confirmation: Confirmación de la nueva contraseña
+ academic:
+ annual_reports:
+ edit:
+ title: 'Rechazar informe anual'
+
admin:
people: 'Información personal'
addresses: 'Domicilios'
@@ -1784,6 +1789,7 @@ es:
index:
new: 'Agregar nuevo usuario'
+
show_all: 'Todos'
save: 'Guardar'
cancel: 'Cancelar'
@@ -1812,6 +1818,8 @@ es:
delete_all_selected: 'Borrar registros seleccionados'
destroy_all_empty_associations: 'Borrar registros sin asociaciones'
new_record_confirmation: '¿ Desea agregar este elemento a la lista ?'
+ reject_document_confirmation: '¿ Desea rechazar este documento ?'
+ approve_document_approbation: '¿ Desea aprobar este documento ?'
add_author: 'Asociarse como autor'
del_author: 'Quitarse como autor'
add_attendee: 'Asociarse como asistente'
@@ -1869,6 +1877,10 @@ es:
registered_by: 'Registrado por'
updated_by: 'Actualizado por'
updating_date: 'Fecha de actualización'
+ approved: 'Aprobado'
+ rejected: 'Rechazada'
+ approve: 'Aprobar'
+ reject: 'Rechazar'
reporter:
profile: 'Perfil'
@@ -1908,3 +1920,12 @@ es:
course_instructors: 'Cursos especiales'
conference_attendees: 'Asistencia a eventos académicos'
conference_organizers: 'Comités de congresos'
+
+ academic:
+ annual_reports:
+ index:
+ title: Informes anuales
+
+ annual_plans:
+ index:
+ title: Planes de trabajo
View
2 config/routes.rb
@@ -1,3 +1,3 @@
-%w(base admin academic_secretary web_site).each do |routes|
+%w(base admin academic_secretary web_site academic).each do |routes|
load Rails.root.join("config/routes/#{routes}.rb")
end
View
18 config/routes/academic.rb
@@ -0,0 +1,18 @@
+Salva::Application.routes.draw do
+
+ devise_for :academics, :path => '/academic', :only => :sessions, :format => false,
+ :controllers => { :sessions => "academic/sessions" }
+
+ namespace :academic do
+ resources :annual_reports, :only => [:index, :edit, :update] do
+ get :approve, :on => :member
+ end
+
+ resources :annual_plans, :only => [:index, :edit, :update] do
+ get :approve, :on => :member
+ end
+
+ root :to => "annual_reports#index"
+ end
+
+end
View
2 config/routes/base.rb
@@ -1,6 +1,6 @@
Salva::Application.routes.draw do
- devise_for :users
+ devise_for :users, :only => :sessions
resource :user_profile, :user_settings, :jobposition_log, :user_curriculum, :password, :user_cite
user_resources_for :user_languages, :user_skills, :user_schoolarships, :other_activities,
View
3 config/routes/web_site.rb
@@ -1,5 +1,6 @@
Salva::Application.routes.draw do
namespace :web_site do
- match 'articles' => 'articles#index', :via => :get
+ resources :annual_reports, :only => [:index]
+ resources :annual_plans, :only => [:index]
end
end
View
6 config/web_site_navigation.rb
@@ -0,0 +1,6 @@
+SimpleNavigation::Configuration.run do |navigation|
+ navigation.items do |primary|
+ primary.item :annual_reports, 'Informes anuales', web_site_annual_reports_path
+ primary.item :annual_plans, 'Planes de trabajo', web_site_annual_plans_path
+ end
+end
View
9 db/migrate/20111209011113_remove_old_records_from_documents.rb
@@ -0,0 +1,9 @@
+class RemoveOldRecordsFromDocuments < ActiveRecord::Migration
+ def up
+ execute "DELETE FROM user_documents";
+ execute "DELETE FROM documents WHERE user_id IS NULL;"
+ end
+
+ def down
+ end
+end
View
5 db/migrate/20111213174617_add_comments_to_documents.rb
@@ -0,0 +1,5 @@
+class AddCommentsToDocuments < ActiveRecord::Migration
+ def change
+ add_column :documents, :comments, :text
+ end
+end

0 comments on commit 1f25e45

Please sign in to comment.
Something went wrong with that request. Please try again.