/
denied.rhtml
48 lines (41 loc) · 1.71 KB
/
denied.rhtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<%
# these are member variables because you can't pass locals to an action, only to partials
@type ||= 'Basic' # only really need for create
@deny ||= (card && !card.new_card? ? 'edit' : 'create')
@skip_slot_header ||= false
%>
<% wrap_slot do |slot| %>
<%= slot.header unless @skip_slot_header %>
<div id="denied" class="instruction open-content">
<h1>Ooo. Sorry, but...</h1> <%#ENGLISH%>
<p>
<% if @deny != 'view' && System.read_only? %>
<div>We are currently in read-only mode. Please try again later.</div>
<% else %>
<% if User.current_user.anonymous? %>
You have to <%= link_to "sign in", :controller=>'account', :action=>'signin' %>
<% else %>
You need permission
<% end %>
to
<%= case @deny
when 'view', 'edit' ; @deny+ " " + (card.name ? "<strong>#{fancy_title(card)}</strong>" : 'this card')
when 'create'; "create #{@type} cards"
end
%>
<% end %>
</p>
<% unless @skip_slot_header or @deny=='view' %>
<p>(See the <%= slot.link_to_action('options', 'options') %> tab to learn more.)</p>
<% end %>
<% if User.current_user.anonymous? && Card.new(:typecode=>'InvitationRequest').ok?(:create) %>
<p><%= link_to 'Sign up for a new account', '/account/signup' %>.</p>
<% end %>
</div>
<% if @skip_slot_header && !@type %>
<p><%= link_to_function 'Cancel', %{getSlotSpan(this).replace('')} %></p>
<% end %>
<%= slot.footer unless @skip_slot_header %>
<% end %>
<%# FIXME: this is duplicated effort in lots of cases %>
<%= javascript_tag "setupLinksAndDoubleClicks()" %>