/
show.html.erb
78 lines (67 loc) · 3.51 KB
/
show.html.erb
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<%- set_header :title=>@user.login, :description=>"#{@user.login}'s Queriac Profile - member since #{@user.created_at.strftime('%B %Y')}"-%>
<div id="primary">
<% if params[:bad_command] %>
<% keyword = params[:bad_command] %>
<div class="msg">
<% if current_user? %>
<p>The command you entered (<%= keyword %>) does not exist. What do you want to do about it?</p>
<ul class="options toolbar">
<li class="edit"><%= link_to("Pick a default command and direct orphan queries to it.", settings_path) %></li>
<li class="add"><%= link_to("Create a new command with keyword '#{keyword}'", new_user_command_path(:keyword => keyword)) %></li>
<li class="search">
<% form_tag user_command_execute_path(@user, 'search_form'), :method=>:get do %>
<label for="search_command">Typo? Try again:</label>
<%= text_field_tag 'search_command', "#{params[:bad_command]} #{params[:arguments]}", :size=>30 %>
<%= submit_tag 'Search' %>
<% end %>
</li>
</ul>
<% else %>
<p>The command you entered (<%= keyword %>) does not exist.</p>
<% end %>
</div>
<% elsif params[:private_command] %>
<div class="flash-msg warning">The <b><%= params[:private_command] %></b> command is private. You must <%= link_to("log in", new_session_path) %> to use it.</div>
<% elsif params[:illegal_command] %>
<div class="flash-msg warning">Sorry, <b><%= @user.login %></b> has privatized the <b><%= params[:illegal_command] %></b> command.</div>
<% end %>
<% if @user_commands %>
<%= render :partial => "commands/command_summary_table", :locals => {:commands => @user_commands, :title => "User Commands"} %>
<% else %>
<%= render :partial => "commands/command_summary_table", :locals => {:commands => @quicksearches, :title => "Top Quicksearches"} if @quicksearches %>
<%= render :partial => "commands/command_summary_table", :locals => {:commands => @shortcuts, :title => "Top Shortcuts"} if @shortcuts %>
<%= render :partial => "commands/command_summary_table", :locals => {:commands => @bookmarklets, :title => "Top Bookmarklets"} if @bookmarklets %>
<% end %>
</div>
<div id="secondary">
<h1>Search as <%= @user.login %></h1>
<% form_tag user_command_execute_path(@user, 'search_form'), :method=>:get do %>
<%= text_field_tag 'search_command' %>
<%= submit_tag 'Search' %>
<% end %>
<h1>Options</h1>
<ul class="options toolbar">
<% if current_user? %>
<li class="add"><%= link_to "Create a new command", new_user_command_path %></li>
<% end %>
<li class="command"><%= link_to "View all #{whose} commands", specific_user_commands_path(@user) %></li>
<li class="search"><%= link_to "View all #{whose} queries", user_queries_path(@user) %></li>
<% if current_user? %>
<li class="refresh">
<%= link_to_function "View Commands to Update (#{@commands_to_update.size})", "$('commands_to_update_table').toggle()" %>
</li>
<% end %>
</ul>
<% if current_user? %>
<div id="commands_to_update_table" style="display:none">
<p style="font-size: 10px"><%= image_tag "icons/information.png"%> Updating your commands is optional.
However, the command owner or admin has probably modified the command for a good reason. You should look at the
new version of a command before updating.
</p>
<%= user_command_table @commands_to_update, :columns=>[:name, :url_status], :headers=>[['User Command', {:width=>25}],['Url Status', {:width=>50}]]%>
</div>
<% end %>
<h1>Tags</h1>
<%= tag_cloud_or_list @tags %>
<%= render :partial => "users/user_list" %>
</div>