file_share 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -3,8 +3,6 @@ class FileAttachmentsController < FileShare::ApplicationController
3
3
  # before_filter :load_and_authorize_current_user, :except => [:index, :show, :download]
4
4
 
5
5
  rescue_from Errno::ENOENT, :with => :file_not_found
6
-
7
- helper_method :has_authorization?
8
6
 
9
7
  private
10
8
  def file_not_found(e)
@@ -31,10 +29,6 @@ class FileAttachmentsController < FileShare::ApplicationController
31
29
  #end
32
30
  #session[:return_to] = nil
33
31
  end
34
- def has_authorization?(*args)
35
- # stub
36
- true
37
- end
38
32
  def load_containers
39
33
  @file_containers = FileContainer.all
40
34
  end
@@ -1,5 +1,11 @@
1
1
  class FileShare::ApplicationController < ApplicationController
2
+ helper_method :has_authorization?
3
+
2
4
  private
5
+ # Redefine this method to implement authorization
6
+ def has_authorization?(*args)
7
+ true
8
+ end
3
9
  protected
4
10
  public
5
11
  end
@@ -1,5 +1,9 @@
1
1
  <%= div_for(file_attachment) do %>
2
- <span id="file_attachment_<%= file_attachment.id %>_file_container" class="file_attachment_file_container" style="display:none;"><%= file_attachment.file_container %></span>
2
+ <%= content_tag :span, file_attachment.file_container, {
3
+ :id => "file_attachment_#{file_attachment.id}_file_container",
4
+ :class => "file_attachment_file_container",
5
+ :style => "display:none;"
6
+ } if has_authorization?(:update, file_attachment) %>
3
7
  <%= description_display(file_attachment) %>
4
8
  <%= name_display(file_attachment) %>
5
9
  <%= content_tag :p, :style => "font-size: 11px;" do %>
@@ -24,7 +24,6 @@
24
24
  </div>
25
25
 
26
26
  <% if has_authorization?(:update, FileAttachment.new) %>
27
- <!-- <div id="blank_description_form" style="display: none; padding: 5px 0;"> -->
28
27
  <form id="file_attachment_dynamic_form" class="formtastic" method="post" action="<%= file_attachments_path %>" style="display: none; padding: 5px 0;">
29
28
  <div style="margin: 0pt; padding: 0pt; display: inline;">
30
29
  <input type="hidden" value="put" name="_method" />
@@ -45,7 +44,6 @@
45
44
  <br />
46
45
  <input type="submit" value="Update" /> | <a href="#" class="cancel_dynamic_form">Cancel</a>
47
46
  </form>
48
- <!-- </div> -->
49
47
 
50
48
  <% content_for(:javascript) do %>
51
49
  <script type="text/javascript">
@@ -19,4 +19,4 @@
19
19
  <% end %>
20
20
 
21
21
  <%= f.buttons %>
22
- <% end %>
22
+ <% end if has_authorization?(:create, FileAttachment.new) %>
@@ -1,17 +1,7 @@
1
- <%
2
- #if @file_attachment.event_id.nil?
3
- %>
4
- <p><%= link_to '< back', file_attachments_path, :class => 'fake_button' %></p>
5
- <%
6
- #else
7
- %>
8
- <!-- <p><%=
9
- #link_to '< back', event_path(@file_attachment.event.id), :class => 'fake_button'
10
- %>
11
- </p> -->
12
- <%
13
- #end
14
- %>
1
+ <%- back_path = @file_attachment.attachable_id.blank? ?
2
+ file_attachments_path : polymorphic_path(@file_attachment.attachable_id) -%>
3
+ <p><%= link_to '< back', back_path, :class => 'fake_button' %></p>
4
+
15
5
  <%= content_tag :div do %>
16
6
  <%= semantic_form_for @file_attachment do |form| %>
17
7
  <%= form.inputs do %>
@@ -22,13 +12,8 @@
22
12
  :selected => "#{@file_attachment.attachable_type}_#{@file_attachment.attachable_id}"
23
13
  }
24
14
  }) %>
25
- <%=
26
- #form.input :event, :hint => 'does this file belong somewhere else?'
27
- %>
28
15
  <%= form.input :description, :hint => "of file contents, purpose, etc" %>
29
16
  <% end %>
30
- <%= form.buttons do %>
31
- <%= form.commit_button%>
32
- <% end %>
17
+ <%= form.buttons %>
33
18
  <% end %>
34
- <% end %>
19
+ <% end if has_authorization?(:update, @file_attachment) %>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: file_share
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Jason LaPier