lib/rewritten/server/views/translations.erb in rewritten-0.0.4 vs lib/rewritten/server/views/translations.erb in rewritten-0.1.0

- old
+ new

@@ -1,61 +1,42 @@ <%# @subtabs = resque.queues unless partial? || params[:id].nil? %> -<% if false and queue = params[:id] %> - - <h1>Pending jobs on <span class='hl'><%= queue %></span></h1> - <form method="POST" action="<%=u "/queues/#{queue}/remove" %>" class='remove-queue'> - <input type='submit' name='' value='Remove Queue' onclick='return confirm("Are you absolutely sure? This cannot be undone.");' /> - </form> - <p class='sub'>Showing <%= start = params[:start].to_i + 1 %> to <%= start + 20 %> of <b><%=size = rewritten.size(queue)%></b> jobs</p> - <table class='jobs'> - <tr> - <th>Class</th> - <th>Args</th> - </tr> - <% for job in (jobs = rewritten.peek(queue, start, 20)) %> - <tr> - <td class='class'><%= job['class'] %></td> - <td class='args'><%=h job['args'].inspect %></td> - </tr> - <% end %> - <% if jobs.empty? %> - <tr> - <td class='no-data' colspan='2'>There are no pending jobs in this queue</td> - </tr> - <% end %> - </table> - <%= partial :next_more, :start => start, :size => size %> -<% else %> - - - <h1 class='wi'>Translations</h1> <p class='intro'>The list below contains all the registered translations from an url to target url. To view all translations for a target click on the target URL.</p> <a href="<%= u('/new') %>"> + New Translation </a> - <p class='sub'>Showing <%= (start = params[:start].to_i)+1 %> to <%= start + Rewritten.per_page %> of <b><%=size = Rewritten.size('froms')%></b> translations. </p> + <form method="get"> + <label>Filter:</label> <input type="text" name="f" value="<%= params[:f] %>"/> + <a href="<%= u('/translations') %>"> clear </a> + </form> + + <p class='sub'> + Showing <%= @start + 1%> to <%= [@size, @start + Rewritten.per_page].min %> of <b><%= @size %></b> translations + <% if params[:f] && params[:f] != '' %> + matching: <%= params[:f] %>. + <% else %>.<% end %> + </p> + <table class=''> <tr> <th>from URL (Browser Location)</th> <th>to URL (Your App)</th> </tr> - <% for mapping in Rewritten.list_range("froms", params[:start].to_i, Rewritten.per_page) %> + <% for from,to in @translations %> <tr> - <td class=''><a href="<%= mapping %>" target="new"><%= mapping %></td> - <td class=''><a href="<%= u("/to?to=#{escape(to=Rewritten.redis.get("from:#{mapping}"))}") %>"><%= to %></td> + <td class=''><a href="<%= from %>" target="new"><%= from %></td> + <td class=''><a href="<%= u("/to?to=#{escape(to)}") %>"><%= to %></td> </tr> <% end %> </table> - <% end %> - <%= partial :next_more, :start => start, :size => size %> + <%= partial :next_more, :start => @start, :size => @size %>