Skip to content

Commit

Permalink
progress on getting all of wagn to use the same styling
Browse files Browse the repository at this point in the history
  • Loading branch information
ethn committed Apr 15, 2013
1 parent 356f217 commit 8bb3465
Show file tree
Hide file tree
Showing 11 changed files with 121 additions and 149 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Wagn
Copyright (C) 2011 Grass Commons
Copyright (C) 2013 Grass Commons

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand Down
10 changes: 7 additions & 3 deletions app/assets/javascripts/wagn.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,11 @@ $(window).ready ->
return null if box.val() != name # avert race conditions
status = data['status']
ed = box.parent()
inst = box.closest('fieldset').find '.instruction'
leg = box.closest('fieldset').find('legend')
msg = leg.find '.name-messages'
unless msg[0]
msg = $('<span class="name-messages"></span>')
leg.append msg
ed.removeClass 'real-name virtual-name known-name'
slot_id = box.slot().attr 'card-id' # use id to avoid warning when renaming to name variant
if status != 'unknown' and !(slot_id && parseInt(slot_id) == data['id'])
Expand All @@ -245,9 +249,9 @@ $(window).ready ->
'in virtual'
else
'already in'
inst.html '"<a href="' + wagn.rootPath + '/' + data['url_key'] + '">' + name + '</a>" ' + qualifier + ' use'
msg.html '"<a href="' + wagn.rootPath + '/' + data['url_key'] + '">' + name + '</a>" ' + qualifier + ' use'
else
inst.html ''
msg.html ''

$('.render-error-link').live 'click', (event) ->
msg = $(this).closest('.render-error').find '.render-error-message'
Expand Down
24 changes: 17 additions & 7 deletions app/assets/stylesheets/card.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ html>body .open-view {
overflow: hidden;
white-space: normal;
}
/*
.card-slot > form >.instruction,
.card-slot > .instruction {
background: #eee;
}
}*/

.card-body {
padding: 5px 12px;
}
Expand Down Expand Up @@ -110,6 +112,10 @@ h1.card-title {
.name-editor.known-name input {
border: 3px solid #c22;
}
.name-messages {
font-style: italic;
background: #ffd;
}

.ui-menu .ui-menu-item {
padding: 2px 0;
Expand Down Expand Up @@ -304,7 +310,7 @@ del.diffmod,
padding: 10px;
margin-top: 5px;
color: #444;
}*/
}*
.instruction {
border-left: 0;
border-right: 0;
Expand Down Expand Up @@ -361,13 +367,17 @@ body#wagn .card-slot.recent-changes h2 {
}
.related-view > .card-body > .ALL > .card-header {
background: #ddd;
padding: 5px;
}
.related-view > .card-body > .ALL > .card-header h1 {
color: #000;
}
.related-view > .card-body > .ALL > .card-header,
.related-view > .card-body > .ALL > .card-header .ui-icon {
background-image: url('images/ui-icons_888888_256x240.png')

}
.related-view > .card-body > .ALL > .card-body {
padding: 5px;
padding: 8px 2%;
}

/*------------- closed view -------*/
Expand Down Expand Up @@ -622,12 +632,12 @@ h2.set-label {
.invite-links {
padding: 10px;
margin-top: 10px;
border: 1px solid #66b;
background: #ddd;
text-align: center;
}
.invite-links a {
font-style: normal;
font-weight: bold;
margin-right: 20px;
margin: 0 20px;
}

/*------- permissions ------------------*/
Expand Down
6 changes: 3 additions & 3 deletions app/assets/stylesheets/page.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@

.help, .instruction {
color: #440;
font-style: italic;
text-align: center;
padding: 4px 10px;
}


.instruction {
display: inline-block;
}
/*--- errors -----*/

.exception p {
Expand Down
5 changes: 0 additions & 5 deletions app/views/account/_email.erb

This file was deleted.

94 changes: 36 additions & 58 deletions app/views/account/invite.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%-
email = params[:email] || {}
email = params[:account] || {}
subject = email[:subject] || Card.setting('*invite+*subject') || ''
message = email[:message] || Card.setting('*invite+*message') || ''
SmartName.substitute!( message, {
Expand All @@ -10,72 +10,50 @@ SmartName.substitute!( message, {
div_id = "main-body"
-%>

<h1 class="page-header">Invite A Friend</h1> <%#ENGLISH%>

<iframe id="iframe-<%= div_id %>" height="0" width="0" frameborder="0"></iframe>

<%= wrap_slot do |slot| %>

<iframe id="iframe-<%= div_id %>" height="0" width="0" frameborder="0"></iframe>

<div class="card-header">
<h1>Invite a Friend</h1>
<% if !card.known? %>
<%= raw( slot._render :help, :text=>"Accept account request from: #{link_to_page card.name}" ) %>
<% end %>
</div>

<style> .fieldset td.help { width: 30% ;} </style>
<%= form_for :card, :action=>params[:action] do |f| %>
<%- slot.form = f %>
<div class="card-body">
<%= hidden_field_tag 'element', "#{div_id}" %>
<%= raw error_messages_for( @card ) %>
<%= form_for :email, :action=>params[:action] do |f| %>
<%= hidden_field_tag 'element', "#{div_id}" %>
<%= raw error_messages_for( @account ) %>

<table class="fieldset">
<% if card.cardname.blank? %>
<tr>
<td class="label"><label for="name">Name</label></td>
<td class="field">
<%= text_field( :card, :name, {:class=>'new-card-name', :id=>"new-card-name-field", :autocomplete=>'off'} )%>
</td>
<td class="help"><strong>Title for user's card</strong><br/> Usually a full name.</td><%#ENGLISH%>
</tr>
<tr>
<td class="label"><label for="email">Email</label></td>
<td class="field"><%= text_field :account,:email %></td>
<td class="help">&nbsp;</td> <%#ENGLISH%>
</tr>

<% if !card.known? %>
<%= raw slot._render_name_editor( :help=>'usually first and last name' ) %>
<%= raw slot.fieldset( :email, slot.editor_wrap(:email) { text_field( :account, :email, :size=>60 ) } ) %>
<% else %>
<tr><td colspan="3" class="accept-request-intro" style="text-align: center">
<em>Accept Account Request from:<em> <strong><%= link_to_page card.name %></strong><%#ENGLISH%>
<%= hidden_field( :card, :key ) %>
<%= hidden_field( :account, :email ) %>

</td></tr>
<%= hidden_field( :card, :key ) %>
<%= hidden_field( :account, :email ) %>
<% end %>

<tr>
<td class="label"><label for="subject">Subject</label></td><%#ENGLISH%>
<td class="field" colspan="2"><%= f.text_field :subject, :value=>subject, :size=>60 %></td>
</tr>
<tr>
<td class="label"><label for="message">Message</label></td><%#ENGLISH%>
<td class="field" colspan="2"><%= f.text_area :message, :value=>message, :rows=>15, :cols => 60 %></td>
</tr>

<tr>
<td></td>
<td class="help" colspan="2">We'll create a password and attach it to the email.</td> <%#ENGLISH%>
</tr>

<tr>
<td></td>
<td colspan="2">
<%= submit_tag 'Invite' %>
<!--FIXME with css?-->&nbsp;&nbsp;
<%= link_to 'Cancel', previous_location %>
</td>
</tr>

<tr><td></td><td colspan="2"><%= raw( slot.notice ) %></td></tr>

</table>
<%= raw slot.fieldset( :subject, slot.editor_wrap(:subject) { text_field :email, :subject, :value=>subject, :size=>60 } ) %>
<%= raw slot.fieldset( :message,
slot.editor_wrap(:message) { text_area :email, :message, :value=>message, :rows=>15, :cols => 60 },
:help => "We'll create a password and attach it to the email."
) %>
</div>

<fieldset>
<div class="button-area">
<%= submit_tag 'Invite' %>
<%= link_to 'Cancel', previous_location %>
</div>
</fieldset>

<%= raw( slot.notice ) %>
<% end %>
<% end %>
57 changes: 21 additions & 36 deletions app/views/account/signup.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,36 @@
<%# iframe for file / image uploads?? %>
<iframe id="iframe-<%= div_id %>" height="0" width="0" frameborder="0"></iframe>

<h1 class="page-header">Sign Up</h1><%#ENGLISH%>
<%= wrap_slot do |slot| %>

<div class="card-header">
<h1>Sign Up</h1>

<div class="instruction">
<% if inst = card.rule_card(:add_help, :fallback=>:help) %>
<%= raw( slot.subrenderer(inst).render :core ) %>
<% elsif !User.create_ok? %>
<p><strong>All Account Requests are subject to review.</strong></p><%#ENGLISH%>
<% if card.rule_card(:add_help, :fallback=>:help) %>
<%= raw( slot._render :help, :setting=>:add_help ) %>
<% else %>
<p><strong>Send us the following, and we'll send you a password.</strong></p><%#ENGLISH%>
<%= raw( slot._render :help, :text => ( User.create_ok? ?
'Send us the following, and we\'ll send you a password.' :
'All Account Requests are subject to review.' ) ) %>
<% end %>
</div>

<div class="content">

<%= form_for :card, slot.form_opts(wagn_path( '/account/signup' ), 'card-form') do |f| %>
<%= hidden_field_tag 'element', "#{div_id}" %>
<%= f.hidden_field :type_id %>
<%- slot.form = f %>

<table class="fieldset">
<%= raw( slot.option_header 'Account Details' ) %><%#ENGLISH%>
<%- new_name_field = capture do %><%= f.text_field :name, {:class=>'new-card-name', :id=>"new-card-name-field"} %><% end %>
<%= slot.option( new_name_field,
:name=>"name",
:help=>"<strong>Unique name for your card</strong><br/>usually first and last name",
:label=>"Name") %>

<%= render :partial=>'account/email' %>
<%= raw( slot.option_header 'About You' ) %>
</table>
<%= form_for :card, slot.form_opts(wagn_path( '/account/signup' ), 'card-form') do |f| %>
<%= hidden_field_tag 'element', "#{div_id}" %>
<%= f.hidden_field :type_id %>
<%- slot.form = f %>

<div class="card-body">
<%= raw( slot.with_inclusion_mode(:new) { slot.edit_slot } ) %>
</div>
<div class="submit-tag">
<%= submit_tag 'Submit' %>
</div>
<div class="card-body">
<%= raw slot._render_name_editor( :help=>'usually first and last name' ) %>
<%= raw slot.fieldset( :email, slot.editor_wrap(:email) { text_field( :account, :email ) } ) %>
<%= raw( slot.with_inclusion_mode(:new) { slot.edit_slot :label=>'other' } ) %>
</div>

<fieldset><div class="button-area"><%= submit_tag 'Submit' %></div></fieldset>

<%= raw( slot.notice ) %>
<%= raw( slot.notice ) %>
<% end %>
</div>
<% end %>
<% end %>
</div>
13 changes: 10 additions & 3 deletions lib/wagn/renderer/html.rb
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ def edit_slot args={}
process_content( inc ).strip
end.join
# raw _render_core(args)
elsif args[:short_editor] #card.new_card?
fieldset '', content_field( form )
elsif label = args[:label]
label = '' if label == true
fieldset label, content_field( form )
else
content_field form
end
Expand Down Expand Up @@ -351,11 +352,17 @@ def fieldset title, content, opts={}
%{#{key}="#{attribs[key]}"}
end * ' '
end
help_args = case opts[:help]
when String ; { :text=> opts[:help] }
when Symbol ; { :setting => opts[:help] }
when Hash ; opts[:help]
else ; {}
end
%{
<fieldset #{ attrib_string }>
<legend>
<h2>#{ title }</h2>
#{ _render_help opts[:help] }
#{ _render_help help_args }
</legend>
#{ content }
</fieldset>
Expand Down
Loading

0 comments on commit 8bb3465

Please sign in to comment.