This repository has been archived by the owner on Nov 13, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed Ember, added keyword input with autocomplete.
- Loading branch information
1 parent
bff2a44
commit 1f7ab37
Showing
26 changed files
with
141 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ | ||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ | ||
|
||
jQuery -> | ||
$('#gif_tag_tokens').tokenInput '/tags.json' | ||
theme: "facebook" | ||
# prepopulate with tokens loaded from data-load attribute | ||
# would be useful on a show page | ||
# prePopulate: $('#gif_tag_tokens').data('load') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Place all the behaviors and hooks related to the matching controller here. | ||
# All this logic will automatically be available in application.js. | ||
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//= require_self | ||
//= require_tree . | ||
//= require token-input-facebook | ||
body | ||
font: | ||
family: Helvetica, Arial, sans-serif | ||
|
||
h1 | ||
font-size: 2em |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Place all the styles related to the gifs controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ | ||
ul | ||
padding-left: 0 | ||
|
||
li | ||
list-style: none | ||
|
||
#new_gif | ||
width: 400px | ||
padding-bottom: 1em | ||
.input | ||
width: 30% | ||
|
||
input | ||
font-size: 1em | ||
padding: 3px 5px 4px 5px | ||
margin-bottom: .5em | ||
border: 1px solid black | ||
border-radius: 2px | ||
|
||
input[type="submit"] | ||
margin-top: 1em | ||
float: right | ||
|
||
|
||
#gif-list | ||
clear: both |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Place all the styles related to the tags controller here. | ||
// They will automatically be included in application.css. | ||
// You can use Sass (SCSS) here: http://sass-lang.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
class TagsController < ApplicationController | ||
respond_to :json | ||
def index | ||
@tags = Tag.order(:name) | ||
respond_with do |format| | ||
format.json { render json: @tags.tokens(params[:q]) } | ||
end | ||
end | ||
|
||
def new | ||
respond_with @tag = Tag.new | ||
end | ||
|
||
def create | ||
@tag = Tag.new(params[:tag]) | ||
if @tag.save | ||
respond_with @tag | ||
else | ||
render :new | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module TagsHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
%h2 Add a GIF | ||
= simple_form_for Gif.new do |f| | ||
= f.input :source_url, label: "GIF URL" | ||
= f.input :tag_tokens, label: "Keywords" #, input_html: { data: {load: Tag.all} } | ||
= f.submit | ||
|
||
- unless @gifs.empty? | ||
%ul#gif-list | ||
- @gifs.each do |gif| | ||
%li= image_tag(gif, height: "150") | ||
- @gifs.reverse_each do |gif| | ||
%li= image_tag(gif, alt: gif.source_url, title: gif.tags.to_sentence) | ||
- else | ||
%p No GIFs to show. | ||
%p= link_to "Add Gifs", new_gif_path | ||
|
||
= simple_form_for Gif.new do |f| | ||
= f.input :source_url | ||
= f.submit | ||
%p No GIFs to show. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
!!! | ||
%html | ||
%head | ||
%head | ||
%title Gifhub | ||
= stylesheet_link_tag "application", :media => "all" | ||
= javascript_include_tag "application" | ||
= csrf_meta_tags | ||
%body | ||
%h1 GifHub | ||
= yield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
root to: "gifs#index" | ||
|
||
resources :gifs | ||
resources :tags, only: [:index] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
require 'test_helper' | ||
|
||
class TagsControllerTest < ActionController::TestCase | ||
# test "the truth" do | ||
# assert true | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require 'test_helper' | ||
|
||
class TagsHelperTest < ActionView::TestCase | ||
end |