Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of github.com:rumblelabs/couchbase-tinyurl

  • Loading branch information...
commit 8ed4fa5f51f5302c3e24e73e0ef7448d8634f698 2 parents 5ba03dd + 0993317
@davidjrice davidjrice authored
View
24 app/assets/javascripts/application.js
@@ -11,15 +11,15 @@
//$('#link_url').
-$(function (){
- $('#new_link')
- .bind("ajax:beforeSend", function(e) {
- alert("PROGRESS");
- })
- .bind("ajax:success", function(e){
- alert("SUCCESS");
- })
- .bind("ajax:error", function(e){
- alert("FAIL");
- })
-})
+//$(function (){
+// $('#new_link')
+// .bind("ajax:beforeSend", function(e) {
+// alert("PROGRESS");
+// })
+// .bind("ajax:success", function(e){
+// alert("SUCCESS");
+// })
+// .bind("ajax:error", function(e){
+// alert("FAIL");
+// })
+//})
View
68 app/assets/stylesheets/partials/_layout.css.scss
@@ -35,7 +35,7 @@ p.lead { font-size: 21px; line-height: 27px; color: #777; }
a {
color: $sqsh-blue;
&:hover{
- color: $sqsh-dark-blue
+ opacity: 0.9;
}
}
@@ -150,7 +150,6 @@ hr { border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 10px 0 30px
width: 780px;
text-align:left;
margin-left: 90px;
- margin-top: 60px;
th {
border-bottom: 1px solid $sqsh-mid-grey;
height: 42px;
@@ -212,6 +211,71 @@ hr { border: solid #ddd; border-width: 1px 0 0; clear: both; margin: 10px 0 30px
}
+.link-nav {
+ width: 100%;
+ overflow: hidden;
+ margin: 60px 0 30px 130px;
+ &.my_links a.my_links, &.recent a.recent, &.popular a.popular {
+ color: $sqsh-dark-copy;
+ font-weight: 600;
+ }
+ li {
+ float: left;
+ color: $sqsh-light-copy;
+ font-size: 18px;
+ &:after {
+ content: "|";
+ }
+ &:last-child {
+ &:after {
+ content: none;
+ }
+ }
+ &:first-child {
+ a {
+ padding-left: 0;
+ }
+ }
+ a {
+ text-decoration: none;
+ font-size: 18px;
+ padding: 0 12px;
+ }
+ }
+}
+
+.short-link-container {
+ margin: 30px 130px 0px;
+ overflow:hidden;
+
+ label {
+ display:block;
+ width: 160px;
+ height: 60px;
+ line-height: 60px;
+ font-family: league-gothic, helvetica, sans-serif;
+ text-align: center;
+ font-size: 36px;
+ font-weight: 400;
+ text-transform: uppercase;
+ letter-spacing: 1.3px;
+ position: relative;
+ @include border-radius (3px 0px 0px 3px);
+ background: $sqsh-blue;
+ color: $sqsh-white;
+ float:left;
+ }
+ input[type="text"] {
+ margin:0;
+ float:left;
+ border-right: 1px solid $sqsh-mid-grey;
+ border-left: none;
+ @include border-radius (0px 3px 3px 0px);
+ font-weight: 600;
+ color: $sqsh-blue;
+ }
+
+}
View
9 app/controllers/links_controller.rb
@@ -1,9 +1,10 @@
class LinksController < ApplicationController
def index
- @popular = Link.popular
- @recent = Link.recent
- @my_links = Link.by_session_id(session[:session_id])
+ @filter = params[:filter] ||= "my_links"
+ @popular = Link.popular if params[:filter] == "popular"
+ @recent = Link.recent if params[:filter] == "recent"
+ @my_links = Link.by_session_id(session[:session_id]) if params[:filter] == "my_links"
@link = Link.new
end
@@ -13,7 +14,7 @@ def create
if @link.save
respond_to do |format|
format.html { redirect_to @link }
- format.js { head :status => :success }
+ format.js
end
else
respond_to do |format|
View
2  app/views/links/_form.html.erb
@@ -4,6 +4,6 @@
<%- end -%>
<%- end -%>
<%= form_for @link, :remote => true do |f| %>
- <%= f.text_field :url, :placeholder => "Enter your URL…" %>
+ <input type="text" name="link[url]" id="id_url" placeholder="Enter your URL…"/>
<%= f.submit "Squish It" %>
<%- end -%>
View
6 app/views/links/_short_url.html.erb
@@ -0,0 +1,6 @@
+<div class="short-link-container">
+ <label>Squished</label>
+ <input type="text" onclick="this.focus();this.select()" readonly="readonly" value="<%= "#{short_url(@link)}" %>"/>
+</div>
+
+
View
3  app/views/links/create.js.erb
@@ -0,0 +1,3 @@
+$('.short-link-container').remove();
+$('#new_link').after("<%= escape_javascript(render(:partial => "short_url")) %>");
+$('.link-table').prepend("<%= escape_javascript(render(:partial => "link", :locals => { :link => @link })) %>");
View
17 app/views/links/index.html.erb
@@ -4,15 +4,16 @@
</div>
</div>
<div class="container">
- <%- if @popular.size > 0 -%>
- <%= render 'links', :links => @popular %>
- <%- end -%>
-
- <%- if @my_links.size > 0 -%>
+ <ul class="link-nav <%= " #{@filter}" %>">
+ <li><%= link_to "My Squishes", {:filter => "my_links"}, {:class => "my_links"} %></li>
+ <li><%= link_to "Recently Squished", {:filter => "recent"}, {:class => "recent"} %></li>
+ <li><%= link_to "Popular Squishes", {:filter => "popular"}, {:class => "popular"} %></li>
+ </ul>
+ <%- if @filter == "my_links" %>
<%= render 'links', :links => @my_links %>
- <%- end -%>
-
- <%- if @recent.size > 0 -%>
+ <%- elsif @filter == "popular" %>
+ <%= render 'links', :links => @popular %>
+ <%- elsif @filter == "recent" %>
<%= render 'links', :links => @recent %>
<%- end -%>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.