refinerycms-registrations 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,4 +38,6 @@ $(function() {
38
38
  e.preventDefault();
39
39
  });
40
40
 
41
+
42
+
41
43
  });
@@ -22,6 +22,11 @@ module Refinery
22
22
  # you can use meta fields from your model instead (e.g. browser_title)
23
23
  # by swapping @page for @registration in the line below:
24
24
  present(@page)
25
+
26
+ respond_to do |format|
27
+ format.html
28
+ format.xls
29
+ end
25
30
  end
26
31
 
27
32
  protected
@@ -12,6 +12,14 @@ module Refinery
12
12
 
13
13
  acts_as_indexed :fields => [:title, :locality]
14
14
 
15
+ def self.to_csv(options = {})
16
+ CSV.generate(options) do |csv|
17
+ csv << column_names
18
+ all.each do |product|
19
+ csv << product.attributes.values_at(*column_names)
20
+ end
21
+ end
22
+ end
15
23
 
16
24
 
17
25
  validates :title, :presence => true, :uniqueness => true
@@ -4,10 +4,7 @@
4
4
 
5
5
  </span>
6
6
  <span class='actions'>
7
-
8
- <%= link_to refinery_icon_tag("application_go.png"), refinery.race_registrations_category_path(category),
9
- :title => t('.view_live_html'),
10
- :target => "_blank" %>
7
+
11
8
 
12
9
  <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_race_registrations_admin_category_path(category),
13
10
  :title => t('.edit') %>
@@ -4,10 +4,7 @@
4
4
 
5
5
  </span>
6
6
  <span class='actions'>
7
-
8
- <%= link_to refinery_icon_tag("application_go.png"), refinery.race_registrations_group_path(group),
9
- :title => t('.view_live_html'),
10
- :target => "_blank" %>
7
+
11
8
 
12
9
  <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_race_registrations_admin_group_path(group),
13
10
  :title => t('.edit') %>
@@ -1,7 +1,7 @@
1
1
  <%= render :partial=>"form_header" %>
2
2
  <%#TODO club autocomplete %>
3
3
 
4
- <%= form_for [refinery, :race_registrations, @person] do |f| -%>
4
+ <%= form_for [refinery, :race_registrations, @person], :validate=>false do |f| -%>
5
5
  <%= render '/refinery/admin/error_messages',
6
6
  :object => @person,
7
7
  :include_object_name => true %><br/>
@@ -2,7 +2,12 @@
2
2
  <h2><%= @registration.title %></h2>
3
3
  <h3><%= @registration.locality %> <%= @registration.race_date.strftime("%d.%m.%Y") %></h3>
4
4
 
5
- <p><%= t('.number_of_registered_people') %> <%= @registration.people.count %></p>
5
+ <p style="float: left;"><%= t('.number_of_registered_people') %> <%= @registration.people.count %></p>
6
+
7
+ <p style="float: right;">
8
+ <%= link_to image_tag('refinery/race_registrations/xls.gif') << t('.download') << ' ' , refinery.race_registrations_registration_path(@registration, format: "xls") %>
9
+ </p>
10
+ <p style="clear:both;"></p>
6
11
 
7
12
 
8
13
  <%= render :partial => '/refinery/message' %>
@@ -0,0 +1,75 @@
1
+ <?xml version="1.0"?>
2
+ <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
3
+ xmlns:o="urn:schemas-microsoft-com:office:office"
4
+ xmlns:x="urn:schemas-microsoft-com:office:excel"
5
+ xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
6
+ xmlns:html="http://www.w3.org/TR/REC-html40">
7
+ <Worksheet ss:Name="Sheet1">
8
+
9
+
10
+ <Table>
11
+ <Row>
12
+ <Cell><Data ss:Type="String">
13
+ <b><%= @registration.title %></b>
14
+ </Data>
15
+ </Cell>
16
+ </Row>
17
+ <Row>
18
+ <Cell><Data ss:Type="String">
19
+ <B><%= @registration.locality %> <%= @registration.race_date.strftime("%d.%m.%Y") %></B>
20
+ </Data>
21
+ </Cell>
22
+ </Row>
23
+ <Row>
24
+ <Cell><Data ss:Type="String">
25
+ <B><%= t('refinery.race_registrations.registrations.registration.number_of_registered_people') %> <%= @registration.people.count %></B>
26
+ </Data>
27
+ </Cell>
28
+ </Row>
29
+
30
+
31
+ <% @registration.categories.each do |category| %>
32
+ <% people_in_category = @registration.people.in_category(category.id, sort_column(), sort_direction() ) %>
33
+
34
+ <% if people_in_category.count > 0 %>
35
+
36
+ <Row>
37
+ <Cell><Data ss:Type="String"><B><%= category.title %></B></Data></Cell>
38
+ </Row>
39
+ <Row>
40
+ <Cell><Data ss:Type="String"><%= t('activerecord.attributes.refinery/race_registrations/person.num') %></Data></Cell>
41
+ <Cell><Data ss:Type="String"><%= t('activerecord.attributes.refinery/race_registrations/person.surname') %></Data></Cell>
42
+ <Cell><Data ss:Type="String"><%= t('activerecord.attributes.refinery/race_registrations/person.name') %></Data></Cell>
43
+ <Cell><Data ss:Type="String"><%= t('activerecord.attributes.refinery/race_registrations/person.country') %></Data></Cell>
44
+ <Cell><Data ss:Type="String"><%= t('activerecord.attributes.refinery/race_registrations/person.birth_date') %></Data></Cell>
45
+ <Cell><Data ss:Type="String"><%= t('activerecord.attributes.refinery/race_registrations/person.club') %></Data></Cell>
46
+ <Cell><Data ss:Type="String"><%= t('activerecord.attributes.refinery/race_registrations/person.city') %></Data></Cell>
47
+ <Cell><Data ss:Type="String"><%= t('activerecord.attributes.refinery/race_registrations/person.created_at') %></Data></Cell>
48
+ </Row>
49
+
50
+ <% people_in_category.each_with_index do |person,index| %>
51
+ <Row>
52
+ <Cell><Data ss:Type="String"><%= index + 1 %></Data></Cell>
53
+ <Cell><Data ss:Type="String"><%= person.surname %></Data></Cell>
54
+ <Cell><Data ss:Type="String"><%= person.name %></Data></Cell>
55
+ <Cell><Data ss:Type="String"><%= person.country %></Data></Cell>
56
+ <Cell><Data ss:Type="String"><%= person.birth_date %></Data></Cell>
57
+ <Cell><Data ss:Type="String"><%= person.club %></Data></Cell>
58
+ <Cell><Data ss:Type="String"><%= person.city %></Data></Cell>
59
+ <Cell><Data ss:Type="String"><%= person.created_at.strftime("%d.%m.%Y %H:%M") %></Data></Cell>
60
+ </Row>
61
+ <% end %>
62
+
63
+ <% end %>
64
+ <Row>
65
+ <Cell>
66
+ <Data ss:Type="String">
67
+
68
+ </Data>
69
+ </Cell>
70
+ </Row>
71
+ <% end %>
72
+ </Table>
73
+ </Worksheet>
74
+ </Workbook>
75
+
@@ -4,5 +4,6 @@ Refinery::Core.configure do |config|
4
4
 
5
5
  #Register extra stylesheet for backend (optional options)
6
6
  config.register_stylesheet "refinery/race_registrations/admin/race_registrations.css"
7
+ config.register_stylesheet "refinery/race_registrations/admin/sortable_table.css"
7
8
  end
8
9
 
@@ -102,6 +102,7 @@ en:
102
102
  other: Other People
103
103
  registrations:
104
104
  registration:
105
+ download: "Download"
105
106
  number_of_registered_people: "Number of registered people:"
106
107
  sorry_no_registrations: 'Sorry, no registration found.'
107
108
  registration_chooser:
@@ -116,6 +117,7 @@ en:
116
117
  refinery/race_registrations/category:
117
118
  title: Title
118
119
  refinery/race_registrations/person:
120
+ num: Num
119
121
  id: ID
120
122
  name: Name
121
123
  surname: Surname
@@ -121,6 +121,7 @@ es:
121
121
  refinery/race_registrations/category:
122
122
  title: Title
123
123
  refinery/race_registrations/person:
124
+ num: Num
124
125
  id: ID
125
126
  name: Name
126
127
  surname: Surname
@@ -119,6 +119,7 @@ fr:
119
119
  refinery/race_registrations/category:
120
120
  title: Title
121
121
  refinery/race_registrations/person:
122
+ num: Num
122
123
  id: ID
123
124
  name: Name
124
125
  surname: Surname
@@ -121,6 +121,7 @@ nb:
121
121
  refinery/race_registrations/category:
122
122
  title: Title
123
123
  refinery/race_registrations/person:
124
+ num: Num
124
125
  id: ID
125
126
  name: Name
126
127
  surname: Surname
@@ -121,6 +121,7 @@ nl:
121
121
  refinery/race_registrations/category:
122
122
  title: Title
123
123
  refinery/race_registrations/person:
124
+ num: Num
124
125
  id: ID
125
126
  name: Name
126
127
  surname: Surname
@@ -103,6 +103,7 @@ sk:
103
103
  other: Daľšie osoby
104
104
  registrations:
105
105
  registration:
106
+ download: "Stiahnuť"
106
107
  number_of_registered_people: 'Priebežne zaregistrovaných jazdcov:'
107
108
  sorry_no_registrations: 'Ľutujeme, hľadaná registrácia sa nenašla.'
108
109
  registration_chooser:
@@ -118,6 +119,7 @@ sk:
118
119
  refinery/race_registrations/category:
119
120
  title: Názov
120
121
  refinery/race_registrations/person:
122
+ num: P.č.
121
123
  id: ID
122
124
  name: Meno
123
125
  surname: Priezvisko
@@ -21,6 +21,7 @@ module Refinery
21
21
  config.to_prepare do
22
22
  require 'refinerycms-pages'
23
23
  require 'humanizer'
24
+ require 'csv'
24
25
  Refinery::PagesController.send :include, Refinery::RaceRegistrations::Extensions::PagesController
25
26
  end
26
27
 
data/readme.md CHANGED
@@ -69,6 +69,11 @@ If you don't have Chosen JS included in your backend yet, append this code to yo
69
69
  config.register_stylesheet "refinery/race_registrations/admin/chosen.css"
70
70
  ```
71
71
 
72
+ To config/initializers/mime_types add:
73
+ ```
74
+ Mime::Type.register "application/xls", :xls
75
+ ```
76
+
72
77
  Before production, don't forget to precompile assets by:
73
78
 
74
79
  ```ruby
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: refinerycms-registrations
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Martin Markech
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-21 00:00:00.000000000 Z
12
+ date: 2013-01-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  type: :runtime
@@ -79,6 +79,7 @@ files:
79
79
  - app/assets/images/refinery/race_registrations/admin/chosen-sprite.png
80
80
  - app/assets/images/refinery/race_registrations/down_arrow.png
81
81
  - app/assets/images/refinery/race_registrations/up_arrow.png
82
+ - app/assets/images/refinery/race_registrations/xls.gif
82
83
  - app/assets/javascripts/refinery/race_registrations/admin/race_registrations.js
83
84
  - app/assets/javascripts/refinery/race_registrations/admin/jquery.chosen.min.js
84
85
  - app/assets/javascripts/refinery/race_registrations/race_registrations.js
@@ -129,6 +130,7 @@ files:
129
130
  - app/views/refinery/race_registrations/categories/index.html.erb
130
131
  - app/views/refinery/race_registrations/categories/show.html.erb
131
132
  - app/views/refinery/race_registrations/registrations/show.html.erb
133
+ - app/views/refinery/race_registrations/registrations/show.xls.erb
132
134
  - app/views/refinery/race_registrations/registrations/_registration_chooser.html.erb
133
135
  - app/views/refinery/race_registrations/registrations/_registration.html.erb
134
136
  - app/views/refinery/race_registrations/groups/index.html.erb