Filters removed from settings page

This commit is contained in:
Raymon Johnstone 2014-05-14 16:16:26 -04:00
parent 64f3bf8bbe
commit 02b87fdafe
6 changed files with 2503 additions and 102 deletions

View file

@ -252,12 +252,11 @@ button.button:hover, a.button:hover, input[type="submit"]:hover {
.edit_user{
display: block;
width: 800px;
width: 225px;
position:absolute;
left:50%;
top:0;
left:70%;
top:25%;
margin:50px 0 0 -420px;
background: url('bg.png');
padding: 20px;
border-radius: 15px;
color: #000;

File diff suppressed because it is too large Load diff

97
app/views/users/REMOVED Normal file
View file

@ -0,0 +1,97 @@
<%= formula_form_for @user, url: user_url do |form| %>
<h3>Choose Active Metacodes</h3>
<div class="allMetacodes"><span id="showAll">Show All</span><span id="hideAll">Hide All</span></div>
<div class="clearfloat"></div>
<div class="editMetacodes">
<ul id="filters-one">
<% $i = 0 %>
<% @m = Metacode.order("name").all %>
<% while $i < (Metacode.all.length / 4) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-two">
<% while $i < (Metacode.all.length / 4 * 2) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-three">
<% while $i < (Metacode.all.length / 4 * 3) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-four">
<% while $i < Metacode.all.length do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<div class="clearfloat"></div>
</div>
<script>
var selectMetacodes = new Array;
var allMetacodes = new Array;
<% Metacode.all.each do |m| %>
<% if m.hasSelected(@user) %>
selectMetacodes.push("<%= m.id %>");
<% end %>
allMetacodes.push("<%= m.id %>");
<% end %>
$(document).ready(function() {
$('#metacodes_0').val(selectMetacodes.toString());
$('.editMetacodes li').click(function() {
if ($(this).attr('class') != 'toggledOff') {
$(this).addClass('toggledOff');
var value_to_remove = $(this).attr('id');
selectMetacodes.splice(selectMetacodes.indexOf(value_to_remove), 1);
$('#metacodes_value').val(selectMetacodes.toString());
}
else if ($(this).attr('class') == 'toggledOff') {
$(this).removeClass('toggledOff');
selectMetacodes.push($(this).attr('id'));
$('#metacodes_value').val(selectMetacodes.toString());
}
});
$('#showAll').click(function() {
$('.editMetacodes li').removeClass('toggledOff');
selectMetacodes = allMetacodes;
$('#metacodes_value').val(selectMetacodes.toString());
});
$('#hideAll').click(function() {
$('.editMetacodes li').addClass('toggledOff');
selectMetacodes = [];
$('#metacodes_value').val(0);
});
$('.edit_user').bind('submit', function(event) {
if (selectMetacodes.length == 0) {
alert('Would you pretty please select at least one metacode to map with?');
return false;
}
});
});
</script>

0
app/views/users/REMOVED~ Normal file
View file

View file

@ -5,58 +5,10 @@
#%>
<% content_for :title, @user.name + "'s Settings | Metamaps" %>
<%= formula_form_for @user, url: user_url do |form| %>
<h1 class="index">Your Settings</h1>
<%= formula_form_for @user, url: user_url do |form| %>
<h3>Choose Active Metacodes</h3>
<div class="allMetacodes"><span id="showAll">Show All</span><span id="hideAll">Hide All</span></div>
<div class="clearfloat"></div>
<div class="editMetacodes">
<ul id="filters-one">
<% $i = 0 %>
<% @m = Metacode.order("name").all %>
<% while $i < (Metacode.all.length / 4) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-two">
<% while $i < (Metacode.all.length / 4 * 2) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-three">
<% while $i < (Metacode.all.length / 4 * 3) do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<ul id="filters-four">
<% while $i < Metacode.all.length do %>
<li id="<%= @m[$i].id %>" <% if not @m[$i].hasSelected(@user) %>class="toggledOff"<% end %> >
<img src="/assets/<%= @m[$i].icon %>" alt="<%= @m[$i].name %>" />
<p><%= @m[$i].name.downcase %></p>
<div class="clearfloat"></div>
</li>
<% $i += 1 %>
<% end %>
</ul>
<div class="clearfloat"></div>
</div>
<h3>Edit Account</h3>
<%= form.input :name, label: "Name", class: "name" %>
<%= form.input :email, label: "Email", class: "email" %>
@ -65,51 +17,3 @@
<%= form.submit "Update", class: "update" %>
<% end %>
<script>
var selectMetacodes = new Array;
var allMetacodes = new Array;
<% Metacode.all.each do |m| %>
<% if m.hasSelected(@user) %>
selectMetacodes.push("<%= m.id %>");
<% end %>
allMetacodes.push("<%= m.id %>");
<% end %>
$(document).ready(function() {
$('#metacodes_0').val(selectMetacodes.toString());
$('.editMetacodes li').click(function() {
if ($(this).attr('class') != 'toggledOff') {
$(this).addClass('toggledOff');
var value_to_remove = $(this).attr('id');
selectMetacodes.splice(selectMetacodes.indexOf(value_to_remove), 1);
$('#metacodes_value').val(selectMetacodes.toString());
}
else if ($(this).attr('class') == 'toggledOff') {
$(this).removeClass('toggledOff');
selectMetacodes.push($(this).attr('id'));
$('#metacodes_value').val(selectMetacodes.toString());
}
});
$('#showAll').click(function() {
$('.editMetacodes li').removeClass('toggledOff');
selectMetacodes = allMetacodes;
$('#metacodes_value').val(selectMetacodes.toString());
});
$('#hideAll').click(function() {
$('.editMetacodes li').addClass('toggledOff');
selectMetacodes = [];
$('#metacodes_value').val(0);
});
$('.edit_user').bind('submit', function(event) {
if (selectMetacodes.length == 0) {
alert('Would you pretty please select at least one metacode to map with?');
return false;
}
});
});
</script>

View file

@ -0,0 +1,20 @@
<%#
# @file
# /users/:id/edit
# User edit form
#%>
<% content_for :title, @user.name + "'s Settings | Metamaps" %>
<h1 class="index">Your Settings</h1>
<h3>Edit Account</h3>
<%= form.input :name, label: "Name", class: "name" %>
<%= form.input :email, label: "Email", class: "email" %>
<%= form.input :password, label: "Password", class: "password" %>
<%= hidden_field(:metacodes, :value, {:value => 0}) %>
<%= form.submit "Update", class: "update" %>
<% end %>