Browse files

contributors page and new capture interface start

  • Loading branch information...
1 parent 366ae0d commit 17576836812f3b06998cd52027d997241e2a89d4 @jywarren committed Dec 11, 2012
View
5 webserver/app/controllers/users_controller.rb
@@ -13,6 +13,11 @@ def dashboard
def new
@user = User.new
end
+
+ def contributors
+ @users = User.find :all
+ render :layout => "bootstrap"
+ end
def list
if true#(logged_in? && current_user.role == "admin")
View
2 webserver/app/models/user.rb
@@ -30,7 +30,7 @@ def spectra
end
def comments
- Comment.find_all_by_author(self.author)
+ Comment.find_all_by_author(self.login)
end
def received_comments
View
22 webserver/app/views/capture/index-mobile-alt.html.erb
@@ -1,32 +1,38 @@
+<script src="/javascripts/getUserMedia.js"> </script>
+<script src="/javascripts/jquery.min.js"> </script>
+<script src="/javascripts/capture.js"> </script>
+<script language="javascript" type="text/javascript" src="/javascripts/flot/jquery.flot.js"></script>
+<script language="javascript" type="text/javascript" src="/javascripts/flot/jquery.flot.crosshair.js"></script>
+<script language="javascript" type="text/javascript" src="/javascripts/flot/jquery.flot.threshold.min.js"></script>
+
<div data-role="page" id="page1">
+
<div data-role="content" style="padding: 15px">
<% if params[:action] == "match" %>
<p><b>Click "Match" to find the closest spectrum in the set "<%= @set.title %>"</b></p>
<% end %>
<div id="graph" style="width:100%;height:100px;"></div>
- <br />
<canvas style="width:100%;height:100px;" id="canvas"></canvas>
<div style="width:100%;display:none;" id="webcam"></div>
<span id="match"></span>
<% if params[:action] == "match" %>
- <a data-role="button" data-theme="b" href="javascript:void()" onClick="$W.match();">Match</a>
- <a data-role="button" data-transition="fade" data-theme="c" href="#page2" onClick="$W.saveSpectrum();">Save</a>
+ <a data-role="button" data-theme="b" href="javascript:void()" onClick="$W.match();">Match</a>
+ <a data-role="button" data-transition="fade" data-theme="c" href="#page2" onClick="$W.saveSpectrum();">Save</a>
<% else %>
- <a data-role="button" data-transition="fade" data-theme="b" href="#page2" onClick="$W.saveSpectrum();">Save</a>
+ <div class="btn-group">
+ <a class="btn btn-primary btn-large" href="#page2" onClick="$W.saveSpectrum();">Save</a>
+ <a class="btn btn-large" href="#page2" onClick="$W.saveSpectrum();"><i class="icon icon-question-sign"></i></a>
+ </div>
<% end %>
- <div data-role="fieldcontain">
- <fieldset data-role="controlgroup">
<label for="geotag-toggle">Geotag</label>
<input type="checkbox" name="geotag-toggle" id="geotag-toggle" type="checkbox" />
<label for="rgb-toggle">RGB</label>
<input type="checkbox" name="rgb-toggle" id="rgb-toggle" onChange="$W.toggle_mode()" />
- </fieldset>
- </div>
<% unless logged_in? %><p><a href="/login">Log in</a> to use a recent calibration</p><% end %>
<p>This interface works only on <a href="https://play.google.com/store/apps/details?id=com.opera.browser">Opera Mobile</a>, the only mobile browser currently supporting the MediaStream API</p>
View
8 webserver/app/views/layouts/bootstrap.html.erb
@@ -90,6 +90,14 @@ and justice issues. PLOTS provides an online research space for citizens, linkin
<% if flash[:notice] %><div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">×</button><%= flash[:notice] %></div><% end %>
<% if flash[:error] %><div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">×</button><%= flash[:error] %></div><% end %>
<% if flash[:warning] %><div class="alert alert"><button type="button" class="close" data-dismiss="alert">×</button><%= flash[:warning] %></div><% end %>
+
+ <% if logged_in? && !flash[:notice] && !flash[:error] && !flash[:warning] %>
+ <% if current_user.spectra.length < 3 %>
+ <div class="alert alert"><button type="button" class="close" data-dismiss="alert">×</button>Join other open source spectrometry experimenters on the <a href="http://publiclaboratory.org/user/register">plots-spectrometry mailing list</a>.</a></div>
+ <% elsif current_user.spectra.length >= 3 %>
+ <div class="alert alert"><button type="button" class="close" data-dismiss="alert">×</button><a href="http://publiclaboratory.org">Share your research</a> and reach out to collaborators at <a href="http://publiclaboratory.org">PublicLaboratory.org</a>.</a></div>
+ <% end %>
+ <% end %>
</div>
<%= yield %>
View
26 webserver/app/views/users/contributors.html.erb
@@ -0,0 +1,26 @@
+<div class="container">
+
+<h2>Spectral Workbench contributors</h2>
+
+ <table class="table">
+ <tr>
+ <th>Most recent spectrum</th>
+ <th>Name</th>
+ <th></th>
+ <th>Comments</th>
+ <th>Activity</th>
+ </tr>
+ <% @users.each do |user| %>
+ <% if user.spectra.length > 0 %>
+ <tr>
+ <td><img width="120px" class="img" src="<%= user.spectra.first.photo.url(:thumb) %>" /></td>
+ <td><a href="/profile/<%= user.login %>"><%= user.login %></a> | <a href="http://publiclaboratory.org/people/<%= user.login %>">Public Lab profile</a></td>
+ <td><%= user.spectra.length %> spectra</td>
+ <td><%= user.comments.length %> comments</td>
+ <td>Last uploaded <%= time_ago_in_words(user.spectra.first.created_at) %> ago</td>
+ </tr>
+ <% end %>
+ <% end %>
+ </table>
+
+</div>
View
1 webserver/config/routes.rb
@@ -4,6 +4,7 @@
map.register '/register', :controller => 'users', :action => 'create'
map.signup '/signup', :controller => 'users', :action => 'new'
map.users '/users', :controller => 'users', :action => 'list'
+ map.users '/contributors', :controller => 'users', :action => 'contributors'
map.resources :users
map.resource :session

0 comments on commit 1757683

Please sign in to comment.