diff --git a/app/assets/images/grey_wash_wall.png b/app/assets/images/grey_wash_wall.png
deleted file mode 100644
index d54e889..0000000
Binary files a/app/assets/images/grey_wash_wall.png and /dev/null differ
diff --git a/app/assets/images/old_map.png b/app/assets/images/old_map.png
deleted file mode 100644
index eb2373b..0000000
Binary files a/app/assets/images/old_map.png and /dev/null differ
diff --git a/app/assets/images/old_mathematics.png b/app/assets/images/old_mathematics.png
deleted file mode 100644
index 95285ff..0000000
Binary files a/app/assets/images/old_mathematics.png and /dev/null differ
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 52f2c50..b741814 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -10,24 +10,6 @@
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
-//= require jquery
-//= require jquery_ujs
-//= require turbolinks
-//= require bootstrap-sprockets
-//= require bootstrap-datepicker
-//= require bootstrap-tagsinput
-//= require cocoon
-//= require typeahead
-//= require autosize
-//= require chosen.jquery
-//= require codemirror
-//= require markdown
-//= require underscore
+
//= require_tree .
-// Setup star rating automagic
-$(document).on("turbolinks:load", function() {
-
- $("input[data-rating='true']").starRating();
-
-});
\ No newline at end of file
diff --git a/app/assets/javascripts/calculator.js b/app/assets/javascripts/calculator.js
deleted file mode 100644
index 106b795..0000000
--- a/app/assets/javascripts/calculator.js
+++ /dev/null
@@ -1,124 +0,0 @@
-(function($) {
-
- function State() {
- this.input = null;
- this.outputUnit = null;
- this.density = null;
- this.changed = false;
- }
-
- State.prototype.setInput = function(value) {
- if (value != this.input) {
- this.changed = true;
- this.input = value;
- }
- };
-
- State.prototype.setDensity = function(value) {
- if (value != this.density) {
- this.changed = true;
- this.density = value;
- }
- };
-
- State.prototype.setOutputUnit = function(value) {
- if (value != this.outputUnit) {
- this.changed = true;
- this.outputUnit = value;
- }
- };
-
- State.prototype.is_changed = function() {
- return this.changed;
- };
-
- State.prototype.reset = function() {
- this.changed = false;
- };
-
- var ingredientSearchEngine = new Bloodhound({
- initialize: false,
- datumTokenizer: function(datum) {
- return Bloodhound.tokenizers.whitespace(datum.name);
- },
- queryTokenizer: Bloodhound.tokenizers.whitespace,
- identify: function(datum) { return datum.id; },
- sorter: function(a, b) {
- if (a.name < b.name) {
- return -1;
- } else if (b.name < a.name) {
- return 1;
- } else {
- return 0;
- }
- },
- remote: {
- url: '/calculator/ingredient_search.json?query=%QUERY',
- wildcard: '%QUERY'
- }
- });
-
- $(document).on("turbolinks:load", function() {
-
- var state = new State();
- var $input = $("#input");
- var $output = $("#output");
- var $density = $("#density");
- var $outputUnit = $("#output_unit");
-
- var performUpdate = _.debounce(function() {
- $.getJSON(
- "/calculator/calculate",
- {input: $input.val(), output_unit: $outputUnit.val(), density: $density.val()},
- function(data) {
- if (data.errors.length) {
- $("#errors_panel").show();
- $("#errors_container").html(data.errors.join(" "));
- } else {
- $("#errors_panel").hide();
- }
-
- $output.val(data.output);
- }
- );
-
- }, 500);
-
- var ingredientPicked = function(i) {
- $density.val(i.density);
- $density.trigger('change');
- };
-
- $input.add($outputUnit).add($density).on('change blur keyup', function(evt) {
- state.setInput($input.val());
- state.setOutputUnit($outputUnit.val());
- state.setDensity($density.val());
-
- if (state.is_changed()) {
- performUpdate();
- state.reset();
- }
- });
-
- if ($("#calculator").length) {
- ingredientSearchEngine.initialize(false);
-
- $("#ingredient").typeahead({},
- {
- name: 'ingredients',
- source: ingredientSearchEngine,
- display: function(datum) {
- return datum.name;
- }
- })
- .on("typeahead:select", function(evt, value) {
- ingredientPicked(value);
- })
- .on("typeahead:autocomplete", function(evt, value) {
- ingredientPicked(value);
- });
- }
-
- });
-
-})(jQuery);
\ No newline at end of file
diff --git a/app/assets/javascripts/checkable.js b/app/assets/javascripts/checkable.js
deleted file mode 100644
index 42f5893..0000000
--- a/app/assets/javascripts/checkable.js
+++ /dev/null
@@ -1,36 +0,0 @@
-(function($) {
-
- var pluginName = "checkable";
-
- var defaultOptions = {
- childrenSelector: "li",
- selectedClass: "checked"
- };
-
- var methods = {
- initialize: function (opts, sources) {
-
- return this.each(function() {
- var options = $.extend({}, defaultOptions, opts);
- $(this).on("click", options.childrenSelector, function(evt) {
- $(evt.currentTarget).toggleClass(options.selectedClass);
- });
- });
- }
- };
-
- var privateMethods = {
-
- };
-
- $.fn[pluginName] = function (method) {
- if (methods[method]) {
- return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
- } else if (typeof method === 'object' || ! method) {
- return methods.initialize.apply(this, arguments);
- } else {
- $.error('Method ' + method + ' does not exist on jQuery.' + pluginName);
- }
- };
-
-})(jQuery);
\ No newline at end of file
diff --git a/app/assets/javascripts/flash_messages.js b/app/assets/javascripts/flash_messages.js
deleted file mode 100644
index a603ecf..0000000
--- a/app/assets/javascripts/flash_messages.js
+++ /dev/null
@@ -1,46 +0,0 @@
-
-var flashMessageTypeMap = {
- error: "danger",
- notice: "success"
-};
-
-function flashMessage(flashType, message) {
-
- var timeoutIdContainer = {};
-
- if (flashMessageTypeMap[flashType]) {
- flashType = flashMessageTypeMap[flashType];
- }
-
- var closeButton = $("")
- .addClass("close")
- .append($("").html("×"))
- .bind("click.Flash", function() { $(this).parent().hide({effect: "fade", duration: 1000}); clearTimeout(timeoutIdContainer.id); });
-
- var $flashDiv = $("
")
- .html(message)
- .append(closeButton)
- .addClass("popup")
- .addClass("alert")
- .addClass("alert-" + flashType)
- .hide()
- .appendTo("#flashContainer")
- .show({effect: "pulsate", times: 1, duration: 1500});
-
- timeoutIdContainer.id = setTimeout(function() {
- $flashDiv.unbind(".Flash");
- $flashDiv.hide({effect: "fade", duration: 1000});
- }, 5000);
-}
-
-$(document).on("turbolinks:load", function() {
- $("#flashHolder").find("div").each(function(idx, div) {
- var $div = $(div);
- var type = $div.attr("class");
- var message = $div.html();
-
- $div.remove();
-
- flashMessage(type, message);
- });
-});
\ No newline at end of file
diff --git a/app/assets/javascripts/ingredients.js b/app/assets/javascripts/ingredients.js
deleted file mode 100644
index d32c047..0000000
--- a/app/assets/javascripts/ingredients.js
+++ /dev/null
@@ -1,88 +0,0 @@
-
-window.INGREDIENT_API = {};
-
-(function($) {
-
- function initializeEditor($ingredientForm) {
- usdaFoodSearchEngine.initialize(false);
-
- var $typeahead = $ingredientForm.find(".ndbn_typeahead");
-
- $typeahead.typeahead_search({
- searchUrl: '/ingredients/usda_food_search.html',
- resultsContainer: $ingredientForm.find(".ndbn_results")
- },{
- name: 'usdaFoods',
- source: usdaFoodSearchEngine,
- limit: 20,
- display: function(datum) {
- return datum.name;
- }
- });
-
- $typeahead.on("typeahead_search:selected", function(evt, item) {
- selectNdbn($ingredientForm, item.ndbn);
- });
-
- $ingredientForm.on("click", ".ndbn_results .food_result", function(evt) {
- var $item = $(evt.target);
- var ndbn = $item.data("ndbn");
- selectNdbn($ingredientForm, ndbn);
- return false;
- });
- }
-
- function selectNdbn($ingredientForm, ndbn) {
- var id = $ingredientForm.find("input.id").val();
-
- $ingredientForm.find("input.ndbn").val(ndbn);
- $ingredientForm.attr("action", "/ingredients/" + id + "/select_ndbn").attr("data-remote", "true");
-
- $ingredientForm.submit();
- }
-
- function customTokenizer(str) {
- if (str) {
- var cleaned = str.replace(/,/g, "");
- return Bloodhound.tokenizers.whitespace(cleaned);
- } else {
- return [];
- }
- }
-
- window.INGREDIENT_API.initialize = function() {
- var $ingredientForm = $("#ingredient_form");
-
- if ($ingredientForm.length) {
- initializeEditor($ingredientForm);
- }
- };
-
- var usdaFoodSearchEngine = new Bloodhound({
- initialize: false,
- datumTokenizer: function(datum) {
- var str = datum ? datum.name : null;
- return customTokenizer(str);
- },
- queryTokenizer: customTokenizer,
- identify: function(datum) { return datum.ndbn; },
- sorter: function(a, b) {
- if (a.name < b.name) {
- return -1;
- } else if (b.name < a.name) {
- return 1;
- } else {
- return 0;
- }
- },
- remote: {
- url: '/ingredients/usda_food_search.json?query=%QUERY',
- wildcard: '%QUERY'
- }
- });
-
- $(document).on("turbolinks:load", function() {
- window.INGREDIENT_API.initialize();
- });
-
-})(jQuery);
\ No newline at end of file
diff --git a/app/assets/javascripts/logs.js b/app/assets/javascripts/logs.js
deleted file mode 100644
index e6a1cdb..0000000
--- a/app/assets/javascripts/logs.js
+++ /dev/null
@@ -1,7 +0,0 @@
-(function($) {
-
- $(document).on("turbolinks:load", function() {
- $(".log-form input.datepicker").datepicker({autoclose: true, todayBtn: "linked", format: "yyyy-mm-dd"});
- });
-
-})(jQuery);
\ No newline at end of file
diff --git a/app/assets/javascripts/recipe_editor.js b/app/assets/javascripts/recipe_editor.js
deleted file mode 100644
index 0d9ebc9..0000000
--- a/app/assets/javascripts/recipe_editor.js
+++ /dev/null
@@ -1,393 +0,0 @@
-(function($) {
-
- var ingredientSearchEngine = new Bloodhound({
- initialize: false,
- datumTokenizer: function(datum) {
- return Bloodhound.tokenizers.whitespace(datum.name);
- },
- queryTokenizer: Bloodhound.tokenizers.whitespace,
- identify: function(datum) { return datum.id; },
- sorter: function(a, b) {
- if (a.name < b.name) {
- return -1;
- } else if (b.name < a.name) {
- return 1;
- } else {
- return 0;
- }
- },
- prefetch: {
- url: '/ingredients/prefetch.json',
- cache: false
- },
- remote: {
- url: '/ingredients/search.json?query=%QUERY',
- wildcard: '%QUERY'
- }
- });
-
- // var tagSearchEngine = new Bloodhound({
- // initialize: false,
- // datumTokenizer: function(datum) {
- // return Bloodhound.tokenizers.whitespace(datum.name);
- // },
- // queryTokenizer: Bloodhound.tokenizers.whitespace,
- // identify: function(datum) { return datum.id; },
- // sorter: function(a, b) {
- // if (a.name < b.name) {
- // return -1;
- // } else if (b.name < a.name) {
- // return 1;
- // } else {
- // return 0;
- // }
- // },
- // prefetch: {
- // url: '/tags/prefetch.json',
- // cache: false
- // },
- // remote: {
- // url: '/tags/search.json?query=%QUERY',
- // wildcard: '%QUERY'
- // }
- // });
-
- function reorder($container) {
- $container.find("div.nested-fields").each(function(idx, editor) {
- var $editor = $(editor);
- $editor.find('input.sort_order').val(idx + 1).trigger("changed");
- })
- }
-
-
- function initializeIngredientEditor($container, ingredientSearchEngine) {
- // $container is either an element that contains many editors, or a single editor.
- var $editors = $container.find(".ingredient-typeahead").closest(".nested-fields");
-
- $editors.each(function(idx, elem) {
- var $editor = $(elem);
- var $ingredientId = $editor.find("input.ingredient_id");
- var $group = $editor.find("div.typeahead-group");
-
- $editor.find(".ingredient-typeahead").typeahead({},
- {
- name: 'ingredients',
- source: ingredientSearchEngine,
- display: function(datum) {
- return datum.name;
- }
- });
-
- if ($ingredientId.val().length) {
- $group.addClass("has-success");
- }
- });
- }
-
- function ingredientItemPicked($typeahead, datum) {
- var $container = $typeahead.closest(".nested-fields");
- var $ingredientId = $container.find("input.ingredient_id");
- var $group = $container.find("div.typeahead-group");
-
- $ingredientId.val(datum.id);
- $typeahead.typeahead('val', datum.name);
- $group.addClass("has-success");
- }
-
- function ingredientNameChange($typeahead, ingredientSearchEngine) {
- var $container = $typeahead.closest(".nested-fields");
- var $ingredientId = $container.find("input.ingredient_id");
- var $group = $container.find("div.typeahead-group");
-
- var id = $ingredientId.val();
- var value = $typeahead.typeahead('val');
-
- if (id && id.length) {
- var found = ingredientSearchEngine.get([id]);
- if (found && found[0] && found[0].name != value) {
- // User has chosen something custom
- $ingredientId.val('');
-
- $group.removeClass("has-success");
- }
- }
- }
-
- function addIngredient(item) {
- $("#ingredient-list").one("cocoon:before-insert", function(e, $container) {
- var $ingredientId = $container.find("input.ingredient_id");
- var $name = $container.find("input.ingredient-typeahead");
- var $quantity = $container.find("input.quantity");
- var $units = $container.find("input.units");
- var $preparation = $container.find("input.preparation");
-
- $name.val(item.name);
- $ingredientId.val(item.ingredient_id);
- $units.val(item.units);
- $quantity.val(item.quantity);
- $preparation.val(item.preparation);
- });
-
- $("#addIngredientButton").trigger("click");
- }
-
- function getIngredients() {
- var data = [];
- $("#ingredient-list .ingredient-editor").each(function() {
- var $container = $(this);
-
- var $ingredientId = $container.find("input.ingredient_id");
- var $name = $container.find("input.ingredient-typeahead.tt-input");
- var $quantity = $container.find("input.quantity");
- var $units = $container.find("input.units");
- var $preparation = $container.find("input.preparation");
-
- data.push({ingredient_id: $ingredientId.val(), name: $name.typeahead("val"), quantity: $quantity.val(), units: $units.val(), preparation: $preparation.val()});
- });
-
- return data;
- }
-
-
- $(document).on("turbolinks:load", function() {
-
- var $ingredientList = $("#ingredient-list");
- var $tagInput = $("select.tag_names");
- var $stepInput = $("textarea#recipe_step_text");
-
- if ($ingredientList.length) {
- ingredientSearchEngine.initialize(false);
- }
-
- if ($stepInput.length) {
- CodeMirror.fromTextArea(
- $stepInput[0],
- {
- mode: {
- name: 'markdown',
- strikethrough: true
- },
- // config tomfoolery to enable soft tabs
- extraKeys: {
- Tab: function(cm) {
- if (cm.somethingSelected()) {
- cm.indentSelection("add");
- return;
- }
-
- if (cm.options.indentWithTabs)
- cm.replaceSelection("\t", "end", "+input");
- else
- cm.execCommand("insertSoftTab");
- },
- "Shift-Tab": function(cm) {
- cm.indentSelection("subtract");
- }
- },
- indentUnit: 2,
- tabSize: 2,
- indentWithTabs: false,
- lineWrapping: true,
- lineNumbers: true
- }
- );
- }
-
- $tagInput.tagsinput({
- trimValue: true,
- confirmKeys: [9, 13, 32, 44] // tab, enter, space, comma
- });
-
-
- initializeIngredientEditor($ingredientList, ingredientSearchEngine);
-
- $ingredientList
- .on("cocoon:after-insert", function(e, item) {
- reorder($ingredientList);
- initializeIngredientEditor(item, ingredientSearchEngine);
- })
- .on("cocoon:after-remove", function(e, item) {
- if (item.find(".remove-button.existing").length) {
- item.detach().appendTo("#deleted_ingredients");
- }
- reorder($ingredientList);
- })
- .on("typeahead:change", function(evt, value) {
- ingredientNameChange($(evt.target), ingredientSearchEngine);
- })
- .on("typeahead:select", function(evt, value) {
- ingredientItemPicked($(evt.target), value);
- })
- .on("typeahead:autocomplete", function(evt, value) {
- ingredientItemPicked($(evt.target), value);
- })
- .on("click", "button.ingredient_convert_btn", function(evt) {
-
- });
-
- $('#convert_modal')
- .on('show.bs.modal', function (event) {
- var $button = $(event.relatedTarget);
- var $modal = $(this);
-
- var $editor = $button.closest(".ingredient-editor");
-
- $modal.data('ingredient-editor', $editor);
-
- var $quantity = $editor.find("input.quantity");
- var $units = $editor.find("input.units");
- var $ingredientId = $editor.find("input.ingredient_id");
-
- var $modalQuantity = $modal.find("input.quantity");
- var $modalUnits = $modal.find("input.units");
- var $modalIngredientId = $modal.find("input.ingredient_id");
-
- $modalQuantity.val($quantity.val());
- $modalUnits.val($units.val());
- $modalIngredientId.val($ingredientId.val());
- })
- .on("ajax:success", "form", function(evt, data, status, xhr) {
- var $modal = $("#convert_modal");
- var $editor = $modal.data('ingredient-editor');
-
- if (data.success) {
- var $quantity = $editor.find("input.quantity");
- var $units = $editor.find("input.units");
-
- var $modalOutUnits = $modal.find("input.output_units");
-
- $quantity.val(data.output_quantity);
- if ($modalOutUnits.val().length) {
- $units.val($modalOutUnits.val());
- }
-
- $modal.modal('hide');
- } else {
-
- }
-
- $("#modal_form_container").replaceWith($(data.form_html));
- });
-
- var $bulkIngredientsModal = $("#bulk_ingredients_modal");
- var $ingredientBulkInput = $("#ingredient_bulk_input");
- var $ingredientBulkList = $("#ingredient_bulk_parsed_list");
- autosize($ingredientBulkInput);
-
- var parseBulkIngredients = function() {
- var data = $ingredientBulkInput.val();
- $ingredientBulkList.empty();
-
- var parsed = [];
- var x;
-
- var lines = data.replace("\r", "").split("\n");
-
- var regex = /^(?:([\d\/.]+(?:\s+[\d\/]+)?)\s+)?(?:([\w-]+)(?:\s+of)?\s+)?([^,]*)(?:,\s*(.*))?$/i;
-
- var magicFunc = function(str) {
- if (str == "-") {
- return "";
- } else {
- return str;
- }
- };
-
- for (x = 0; x < lines.length; x++) {
- var line = lines[x].trim();
- if (line.length == 0) { continue; }
-
- var barIndex = line.lastIndexOf("|");
- var afterBar = null;
-
- if (barIndex >= 0) {
- afterBar = line.slice(barIndex + 1);
- line = line.slice(0, barIndex);
- }
-
- var match = line.match(regex);
-
- if (match) {
- item = {quantity: magicFunc(match[1]), units: magicFunc(match[2]), name: magicFunc(match[3]), preparation: magicFunc(match[4])};
- if (afterBar) {
- item.name = item.name + ", " + item.preparation;
- item.preparation = afterBar;
- }
- parsed.push(item);
- } else {
- parsed.push(null);
- }
- }
-
- $bulkIngredientsModal.data("bulkData", parsed);
-
- for (x = 0; x < parsed.length; x++) {
- var item = parsed[x];
- if (item != null) {
- $ingredientBulkList.append(
- $("
")
- .append($(" | ").addClass("quantity").text(item.quantity))
- .append($(" | ").addClass("units").text(item.units))
- .append($(" | ").addClass("name").text(item.name))
- .append($(" | ").addClass("preparation").text(item.preparation))
- );
- } else {
- $ingredientBulkList.append(
- $("
")
- .append($(" | ").attr("colspan", "4").text(""))
- );
- }
- }
- };
-
- $bulkIngredientsModal
- .on('show.bs.modal', function (event) {
- var data = getIngredients();
- var x;
- var text = [];
-
- for (x = 0; x < data.length; x++) {
- var item = data[x];
-
- text.push(
- item.quantity + " " +
- (item.units || "-") + " " +
- item.name +
- (item.preparation ? (", " + item.preparation) : "")
- );
- }
-
- $ingredientBulkInput.val(text.join("\n"));
-
- setTimeout(function() {
- parseBulkIngredients();
- autosize.update($ingredientBulkInput);
- }, 250);
- });
-
- $ingredientBulkInput.on('keyup', function() {
- parseBulkIngredients();
- });
-
- $("#bulkIngredientAddSubmit").on("click", function() {
- var parsed = $bulkIngredientsModal.data("bulkData");
- var x;
-
- $("#ingredient-list").find(".remove-button").trigger("click");
-
- if (parsed && parsed.length) {
- for (x = 0; x < parsed.length; x++) {
- var item = parsed[x];
- if (item) {
- addIngredient(item)
- }
- }
- }
-
- $bulkIngredientsModal.modal('hide')
- });
-
- });
-
-
-})(jQuery);
diff --git a/app/assets/javascripts/recipes.js b/app/assets/javascripts/recipes.js
deleted file mode 100644
index d2f328e..0000000
--- a/app/assets/javascripts/recipes.js
+++ /dev/null
@@ -1,33 +0,0 @@
-(function($) {
-
- $(document).on("turbolinks:load", function() {
- $(".recipe-view ul.ingredients").checkable();
- $(".recipe-view div.steps ol").checkable();
-
- var $searchBtn = $("#recipe_index_search_button");
-
- if ($searchBtn.length) {
- var $form = $("#search_form");
- var $nameInput = $("#name_search");
- var $tagsInput = $("#tags_search");
-
- $form.submit(function() {
- $("#criteria_name").val($nameInput.val());
- $("#criteria_tags").val($tagsInput.val());
- });
-
- $searchBtn.click(function(evt) {
- $form.submit();
- });
-
- $nameInput.add($tagsInput).on('keydown', function(evt) {
- if (evt.which == 13) {
- console.log('keydown enter pressed');
- $form.submit();
- }
- });
-
- }
- });
-
-})(jQuery);
diff --git a/app/assets/javascripts/star_rating.js b/app/assets/javascripts/star_rating.js
deleted file mode 100644
index 7a4eb9e..0000000
--- a/app/assets/javascripts/star_rating.js
+++ /dev/null
@@ -1,133 +0,0 @@
-
-(function ($) {
-
- var pluginName = "starRating";
- var defaultOptions = {
- starCount: 5,
- readOnly: false,
- interval: 1,
- size: '30px'
- };
-
- var methods = {
- initialize: function(opts) {
- return this.each(function() {
- var $input = $(this);
- var attrOpts = {};
- var inputData = $input.data();
-
- if (inputData[pluginName.toLowerCase()] === true) {
- if (console && console.log) {
- console.log("star rating has already been initialized; skipping...");
- }
- return;
- }
-
- $input.attr("data-" + pluginName.toLowerCase(), "true");
-
- if (inputData.interval) {
- attrOpts.interval = inputData.interval;
- }
-
- if (inputData.starcount) {
- attrOpts.starCount = inputData.starcount;
- }
-
- if (inputData.size) {
- attrOpts.size = inputData.size;
- }
-
- if ($input.is(":disabled")) {
- attrOpts.readOnly = true;
- }
-
- var options = _.extend({}, defaultOptions, attrOpts, opts);
-
- var $widget = $("").addClass("star-rating").css({'font-size': options.size});
- var $emptySet = $("").addClass("empty-set").appendTo($widget);
- var $filledSet = $("").addClass("filled-set").appendTo($widget);
-
- options.$input = $input;
- options.$emptySet = $emptySet;
-
- for (var x = 1; x <= options.starCount; x++) {
- $emptySet.append(
- $("").addClass("star empty")
- );
-
- $filledSet.append(
- $("").addClass("star full")
- );
- }
-
- $widget.data(pluginName + ".options", options);
-
- $input.data(pluginName, true).hide().after($widget);
-
- privateMethods.updateStars($widget);
-
- if (!options.readOnly) {
- $widget
- .on("click." + pluginName, function(e) {
- var value = privateMethods.calculateRating($widget, e.pageX);
- privateMethods.setValue($widget, value);
- })
- .on("mousemove." + pluginName, function(e) {
- var value = privateMethods.calculateRating($widget, e.pageX);
- privateMethods.updateStars($widget, value);
- })
- .on("mouseleave." + pluginName, function (e) {
- privateMethods.updateStars($widget);
- });
- }
-
- $input
- .on("change." + pluginName, function() {
- privateMethods.updateStars($widget);
- });
- });
- }
- };
-
- var privateMethods = {
- updateStars: function($widget, value) {
- var options = $widget.data(pluginName + ".options");
- value = (value == null ? (parseFloat(options.$input.val() || 0)) : value);
- $widget.find(".filled-set").css({width: privateMethods.calculateWidth($widget, value)});
- },
-
- setValue: function($widget, value) {
- var options = $widget.data(pluginName + ".options");
- options.$input.val(value);
- privateMethods.updateStars($widget);
- },
-
- calculateWidth: function($widget, value) {
- var options = $widget.data(pluginName + ".options");
- var width = options.$emptySet.width();
- return ((value / options.starCount) * 100).toString() + "%";
- },
-
- // Given a screen X coordinate, calculates the nearest valid value for this rating widget
- calculateRating: function($widget, screenX) {
- var options = $widget.data(pluginName + ".options");
- var offset = options.$emptySet.offset();
- var width = options.$emptySet.width();
- var ratio = (screenX - offset.left) / width;
- ratio = Math.max(0, Math.min(1, ratio));
-
- return Math.ceil(options.starCount * (1 / options.interval) * ratio) / (1 / options.interval);
- }
- };
-
- $.fn[pluginName] = function(method) {
- if (methods[method]) {
- return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
- } else if (typeof method === 'object' || ! method) {
- return methods.initialize.apply(this, arguments);
- } else {
- $.error('Method ' + method + ' does not exist on jQuery.' + pluginName);
- }
- };
-
-})(jQuery);
\ No newline at end of file
diff --git a/app/assets/javascripts/typeahead_search.js b/app/assets/javascripts/typeahead_search.js
deleted file mode 100644
index 0b8c3bc..0000000
--- a/app/assets/javascripts/typeahead_search.js
+++ /dev/null
@@ -1,112 +0,0 @@
-(function($) {
-
- var pluginName = "typeahead_search";
-
- var defaultOptions = {
- };
-
- var methods = {
- initialize: function (opts, sources) {
-
- return this.each(function() {
- var options = $.extend({}, defaultOptions, opts);
- var $this = $(this);
-
- if ($this.data(pluginName)) {
- return;
- }
-
- $this.data(pluginName, {options: options});
-
- var $inputGroup = $('');
- var $btnSpan = $("");
- var $btn = $("").append($("").addClass("glyphicon glyphicon-search"));
-
- $btnSpan.append($btn);
-
- $this.after($inputGroup);
- $this.detach();
- $inputGroup.append($this);
- $inputGroup.append($btnSpan);
-
- $this.typeahead(opts, sources);
-
- $btn.on("click", function(evt) {
- privateMethods.search($this);
- });
-
- $this
- .on("typeahead:change", function(evt, value) {
- privateMethods.change($this, value);
- })
- .on("typeahead:select", function(evt, value) {
- privateMethods.select($this, value);
- })
- .on("typeahead:autocomplete", function(evt, value) {
- privateMethods.autocomplete($this, value);
- })
- .on("keydown", function(evt) {
- if (evt.keyCode == 13) {
- evt.preventDefault();
- privateMethods.search($this);
- }
- });
- });
- },
-
- val: function() {
- if (this.length) {
- return $(this[0]).typeahead("val");
- } else {
- return null;
- }
- }
- };
-
- var privateMethods = {
- change: function($this, value) {
-
- },
-
- select: function($this, item) {
- $this.trigger("typeahead_search:selected", item);
- },
-
- autocomplete: function($this, item) {
- $this.trigger("typeahead_search:selected", item);
- },
-
- search: function($this) {
- var options = privateMethods.options($this);
- var input = $this.typeahead("val");
-
- if (input.length && options.searchUrl && options.searchUrl.length) {
- $.get({
- url: options.searchUrl,
- data: {query: input},
- dataType: 'html',
- success: function(data) {
- $(options.resultsContainer).empty().append(data);
- }
- })
- }
-
- $this.typeahead("close");
- },
-
- options: function($this) {
- return $this.data(pluginName).options;
- }
- };
-
- $.fn[pluginName] = function (method) {
- if (methods[method]) {
- return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
- } else if (typeof method === 'object' || ! method) {
- return methods.initialize.apply(this, arguments);
- } else {
- $.error('Method ' + method + ' does not exist on jQuery.' + pluginName);
- }
- };
-
-})(jQuery);
\ No newline at end of file
diff --git a/app/assets/javascripts/typeahead_selector.js b/app/assets/javascripts/typeahead_selector.js
deleted file mode 100644
index 16a83c4..0000000
--- a/app/assets/javascripts/typeahead_selector.js
+++ /dev/null
@@ -1,70 +0,0 @@
-(function($) {
-
- var pluginName = "typeahead_selector";
-
- var defaultOptions = {
- };
-
- var methods = {
- initialize: function (opts, sources) {
-
- return this.each(function() {
- var options = $.extend({}, defaultOptions, opts);
- var $this = $(this);
- $this.typeahead(opts, sources);
-
- $this
- .on("typeahead:change", function(evt, value) {
- privateMethods.change($this, value);
- })
- .on("typeahead:select", function(evt, value) {
- privateMethods.select($this, value);
- })
- .on("typeahead:autocomplete", function(evt, value) {
- privateMethods.autocomplete($this, value);
- });
- });
- },
-
- val: function() {
- if (this.length) {
- return $(this[0]).data('typeahead_selected');
- } else {
- return null;
- }
- }
- };
-
- var privateMethods = {
- change: function($this, value) {
- var item = $this.data('typeahead_pending');
- if (item) {
- $this.data('typeahead_pending', null);
- $this.data('typeahead_selected', item);
- $this.trigger("typeahead_selector:selected", item);
- } else {
- $this.data('typeahead_selected', null);
- $this.trigger("typeahead_selector:invalid", value);
- }
- },
-
- select: function($this, item) {
- $this.data('typeahead_pending', item);
- },
-
- autocomplete: function($this, item) {
- $this.data('typeahead_pending', item);
- }
- };
-
- $.fn[pluginName] = function (method) {
- if (methods[method]) {
- return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
- } else if (typeof method === 'object' || ! method) {
- return methods.initialize.apply(this, arguments);
- } else {
- $.error('Method ' + method + ' does not exist on jQuery.' + pluginName);
- }
- };
-
-})(jQuery);
\ No newline at end of file
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index 36aeb37..243ae18 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -10,97 +10,4 @@
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
- *= require flash_messages
- *= require chosen
- *= require codemirror
- *= require bootstrap-datepicker3
- *= require bootstrap-tagsinput
- *= require font_references
*/
-
-@import "bootstrap-sprockets";
-@import "journal_custom_colors";
-@import "journal/_variables";
-@import "bootstrap";
-@import "journal/_bootswatch";
-
-@import "typeahead-bootstrap";
-@import "recipes";
-@import "star_rating";
-@import "codemirror_custom";
-
-// Skin overrides
-.has-error {
- .help-block,
- .control-label,
- .radio,
- .checkbox,
- .radio-inline,
- .checkbox-inline,
- &.radio label,
- &.checkbox label,
- &.radio-inline label,
- &.checkbox-inline label,
- .form-control-feedback {
- color: $state-danger-text;
- }
-
- .form-control,
- .form-control:focus {
- border-color: $state-danger-border;
- }
-}
-
-$footer_height: 40px;
-
-html {
- position: relative;
- min-height: 100%;
-}
-body {
- /* Margin bottom by footer height */
- margin-bottom: $footer_height + 20;
- background: image_url("grey_wash_wall.png");
-}
-
-#main_container {
- background: white;
- padding-bottom: 15px;
-}
-
-.footer {
- position: absolute;
- bottom: 0;
- width: 100%;
- height: $footer_height;
- background-color: $gray-lighter;
- border-top: solid 1px $gray-light;
-}
-
-a.sorted {
- position: relative;
-}
-
-a.sorted.asc:after {
- content: " ";
- position: absolute;
- margin: 8px 0 0 6px;
- width: 0;
- height: 0;
- border-left: 5px solid transparent;
- border-right: 5px solid transparent;
-
- border-top: 5px solid black;
-}
-
-a.sorted.desc:after {
- content: " ";
- position: absolute;
- margin: 8px 0 0 6px;
- width: 0;
- height: 0;
- border-left: 5px solid transparent;
- border-right: 5px solid transparent;
-
- border-bottom: 5px solid black;
-}
\ No newline at end of file
diff --git a/app/assets/stylesheets/codemirror_custom.scss b/app/assets/stylesheets/codemirror_custom.scss
deleted file mode 100644
index 5dfe50c..0000000
--- a/app/assets/stylesheets/codemirror_custom.scss
+++ /dev/null
@@ -1,5 +0,0 @@
-.CodeMirror {
- border: 1px solid $gray-light;
- font-family: inconsolata monospace;
- font-size: 15px;
-}
\ No newline at end of file
diff --git a/app/assets/stylesheets/flash_messages.scss b/app/assets/stylesheets/flash_messages.scss
deleted file mode 100644
index b1392f8..0000000
--- a/app/assets/stylesheets/flash_messages.scss
+++ /dev/null
@@ -1,44 +0,0 @@
-
-#flashHolder {
- display: none;
-}
-
-#flashContainer {
- position: fixed;
- width: 100%;
- z-index: 9999;
-}
-
-.alert.popup {
- position: fixed;
- top: 15px;
- left: 50%;
- width: 30em;
- margin-left: -15em;
-}
-
-.alert {
-}
-
-.flash {
- text-align: center;
- width: 30em;
- padding: 5px;
- margin-left: auto;
- margin-right: auto;
-}
-
-.error {
- background-color: #fff6ff;
- border: 3px solid #fda8a8;
-}
-
-.warning {
- background-color: #ffffdd;
- border: 3px solid #ffdd00;
-}
-
-.notice {
- background-color: #D8F6CE;
- border: 3px solid #3ADF00;
-}
\ No newline at end of file
diff --git a/app/assets/stylesheets/font_references.scss b/app/assets/stylesheets/font_references.scss
deleted file mode 100644
index 3830510..0000000
--- a/app/assets/stylesheets/font_references.scss
+++ /dev/null
@@ -1,105 +0,0 @@
-@font-face {
- font-family: 'Open Sans';
- font-style: normal;
- font-weight: 300;
- src: local('Open Sans Light'), local('OpenSans-Light'), font_url("open-sans-light.woff2") format('woff2');
-}
-@font-face {
- font-family: 'Open Sans';
- font-style: normal;
- font-weight: 400;
- src: local('Open Sans'), local('OpenSans'), font_url("open-sans.woff2") format('woff2');
-}
-@font-face {
- font-family: 'Open Sans';
- font-style: normal;
- font-weight: 700;
- src: local('Open Sans Bold'), local('OpenSans-Bold'), font_url("open-sans-bold.woff2") format('woff2');
-}
-@font-face {
- font-family: 'Open Sans';
- font-style: italic;
- font-weight: 400;
- src: local('Open Sans Italic'), local('OpenSans-Italic'), font_url("open-sans-italic.woff2") format('woff2');
-}
-@font-face {
- font-family: 'Open Sans';
- font-style: italic;
- font-weight: 300;
- src: local('Open Sans Light Italic'), local('OpenSansLight-Italic'), font_url("open-sans-light-italic.woff2") format('woff2');
-}
-@font-face {
- font-family: 'Open Sans';
- font-style: italic;
- font-weight: 700;
- src: local('Open Sans Bold Italic'), local('OpenSans-BoldItalic'), font_url("open-sans-bold-italic.woff2") format('woff2');
-}
-
-
-@font-face {
- font-family: 'Roboto';
- font-style: normal;
- font-weight: 300;
- src: local('Roboto Light'), local('Roboto-Light'), font_url("roboto-light.woff2") format('woff2');
-}
-@font-face {
- font-family: 'Roboto';
- font-style: normal;
- font-weight: 400;
- src: local('Roboto'), local('Roboto-Regular'), font_url("roboto.woff2") format('woff2');
-}
-@font-face {
- font-family: 'Roboto';
- font-style: normal;
- font-weight: 500;
- src: local('Roboto Medium'), local('Roboto-Medium'), font_url("roboto-medium.woff2") format('woff2');
-}
-@font-face {
- font-family: 'Roboto';
- font-style: normal;
- font-weight: 700;
- src: local('Roboto Bold'), local('Roboto-Bold'), font_url("roboto-bold.woff2") format('woff2');
-}
-
-@font-face {
- font-family: 'Raleway';
- font-style: normal;
- font-weight: 400;
- src: local('Raleway'), font_url("raleway.woff2") format('woff2');
-}
-@font-face {
- font-family: 'Raleway';
- font-style: normal;
- font-weight: 700;
- src: local('Raleway Bold'), local('Raleway-Bold'), font_url("raleway-bold.woff2") format('woff2');
-}
-
-
-@font-face {
- font-family: 'News Cycle';
- font-style: normal;
- font-weight: 400;
- src: local('News Cycle'), local('NewsCycle'), font_url("news-cycle.woff2") format('woff2');
-}
-@font-face {
- font-family: 'News Cycle';
- font-style: normal;
- font-weight: 700;
- src: local('News Cycle Bold'), local('NewsCycle-Bold'), font_url("news-cycle-bold.woff2") format('woff2');
-}
-
-
-@font-face {
- font-family: 'Inconsolata';
- font-style: normal;
- font-weight: 400;
- src: local('Inconsolata Regular'), local('Inconsolata-Regular'), font_url('inconsolata.woff2') format('woff2');
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
-}
-@font-face {
- font-family: 'Inconsolata';
- font-style: normal;
- font-weight: 700;
- src: local('Inconsolata Bold'), local('Inconsolata-Bold'), font_url('inconsolata-bold.woff2') format('woff2');
- unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215;
-}
\ No newline at end of file
diff --git a/app/assets/stylesheets/ingredients.scss b/app/assets/stylesheets/ingredients.scss
deleted file mode 100644
index 98f8d50..0000000
--- a/app/assets/stylesheets/ingredients.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-// Place all the styles related to the ingredients controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
diff --git a/app/assets/stylesheets/journal_custom_colors.scss b/app/assets/stylesheets/journal_custom_colors.scss
deleted file mode 100644
index 4196c72..0000000
--- a/app/assets/stylesheets/journal_custom_colors.scss
+++ /dev/null
@@ -1,5 +0,0 @@
-
-$brand-primary: darken(#93C54B, 10%);
-$brand-success: $brand-primary;
-$text-color: #3E3F3A;
-
diff --git a/app/assets/stylesheets/recipes.scss b/app/assets/stylesheets/recipes.scss
deleted file mode 100644
index 647c0b5..0000000
--- a/app/assets/stylesheets/recipes.scss
+++ /dev/null
@@ -1,76 +0,0 @@
-// Place all the styles related to the recipes controller here.
-// They will automatically be included in application.css.
-// You can use Sass (SCSS) here: http://sass-lang.com/
-
-div.table_tags {
- width: 275px;
-}
-
-div.recipe_list_controls {
- width: 85px;
-}
-
-@mixin editor {
-
- @extend .well;
- @extend .well-sm;
-
- margin-bottom: 10px;
- padding-top: 4px;
-
- .form-group {
- margin-bottom: 10px;
- }
-
- .remove-button {
- @extend .btn;
- @extend .btn-danger;
- @extend .btn-sm;
-
- position: absolute;
- top: 0;
- right: 9px;
- }
-}
-
-div.ingredient-editor {
- @include editor;
-
-}
-
-div#ingredient-list {
- padding-bottom: 15px;
-}
-
-div#ingredient-list {
-
- @media (min-width: $screen-md-min) {
- .ingredient-editor .control-label {
- display: none;
- }
-
- .ingredient-editor:first-child .control-label {
- display: inline-block;
- }
- }
-}
-
-div.recipe-view {
-
- .source {
- @extend .col-xs-6;
- word-wrap: break-word;
- }
-
- .ingredients div {
- padding-bottom: 15px;
- }
-
- .steps div {
- padding-bottom: 15px;
- }
-
- li.checked {
- text-decoration: line-through;
- }
-}
\ No newline at end of file
diff --git a/app/assets/stylesheets/star_rating.scss b/app/assets/stylesheets/star_rating.scss
deleted file mode 100644
index 44f1186..0000000
--- a/app/assets/stylesheets/star_rating.scss
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-span.star-rating {
-
- display: inline-block;
- color: gold;
- cursor: default;
- position: relative;
- white-space: nowrap;
-
- .empty-set {
- color: gray;
- opacity: 0.5;
- }
-
- .filled-set {
- overflow-x: hidden;
- position: absolute;
- top: 0;
- left: 0;
- }
-
- span.star {
-
- @extend .glyphicon;
-
- &.empty {
- @extend .glyphicon-star-empty;
- }
-
- &.full {
- @extend .glyphicon-star;
- }
- }
-
-}
\ No newline at end of file
diff --git a/app/assets/stylesheets/typeahead-bootstrap.scss b/app/assets/stylesheets/typeahead-bootstrap.scss
deleted file mode 100644
index 67090b2..0000000
--- a/app/assets/stylesheets/typeahead-bootstrap.scss
+++ /dev/null
@@ -1,64 +0,0 @@
-span.twitter-typeahead .tt-menu,
-span.twitter-typeahead .tt-dropdown-menu {
- position: absolute;
- top: 100%;
- left: 0;
- z-index: 1000;
- display: none;
- float: left;
- min-width: 160px;
- padding: 5px 0;
- margin: 2px 0 0;
- list-style: none;
- font-size: 14px;
- text-align: left;
- background-color: #ffffff;
- border: 1px solid #cccccc;
- border: 1px solid rgba(0, 0, 0, 0.15);
- border-radius: 4px;
- -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
- box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
- background-clip: padding-box;
-}
-
-span.twitter-typeahead .tt-hint {
- color: #A5A5A5;
-}
-
-span.twitter-typeahead .tt-suggestion {
- display: block;
- padding: 3px 20px;
- clear: both;
- font-weight: normal;
- line-height: 1.42857143;
- color: #333333;
- white-space: nowrap;
-}
-
-span.twitter-typeahead .tt-suggestion.tt-cursor,
-span.twitter-typeahead .tt-suggestion:hover,
-span.twitter-typeahead .tt-suggestion:focus {
- color: #ffffff;
- text-decoration: none;
- outline: 0;
- background-color: #337ab7;
-}
-
-span.twitter-typeahead {
- width: 100%;
-}
-.input-group span.twitter-typeahead {
- display: block !important;
-}
-.input-group span.twitter-typeahead .tt-menu,
-.input-group span.twitter-typeahead .tt-dropdown-menu {
- top: 32px !important;
-}
-.input-group.input-group-sm span.twitter-typeahead .tt-menu,
-.input-group.input-group-sm span.twitter-typeahead .tt-dropdown-menu {
- top: 28px !important;
-}
-.input-group.input-group-lg span.twitter-typeahead .tt-menu,
-.input-group.input-group-lg span.twitter-typeahead .tt-dropdown-menu {
- top: 44px !important;
-}
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 095f5d7..5d3ea78 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -13,57 +13,4 @@ module ApplicationHelper
decorated
end
- def timestamp(time)
- time ? time.strftime('%D %R') : ''
- end
-
- def nav_items
- nav = [
- nav_item('Recipes', recipes_path, 'recipes'),
- nav_item('Ingredients', ingredients_path, 'ingredients'),
- nav_item('Logs', logs_path, 'logs', current_user?),
- nav_item('Calculator', calculator_path, 'calculator'),
- nav_item('About', about_path, 'home'),
- nav_item('Notes', notes_path, 'notes', current_user?),
- nav_item('Admin', admin_users_path, 'admin/users', current_user? && current_user.admin?)
- ]
-
- nav.compact
- end
-
- def profile_nav_items
- if current_user
- [content_tag('li', class: 'dropdown') do
- li_cnt = ''.html_safe
-
- li_cnt << link_to('#', class: 'dropdown-toggle', data: {toggle: 'dropdown'}, role: 'button') do
- ''.html_safe << "#{current_user.display_name}" << content_tag('span', '', class: 'caret')
- end
-
- li_cnt << content_tag('ul', class: 'dropdown-menu') do
- ''.html_safe << nav_item('Profile', edit_user_path) << nav_item('Logout', logout_path)
- end
-
- li_cnt
- end]
- else
- [nav_item('Login', login_path)]
- end
- end
-
- def nav_item(name, url, controller = nil, visible = true)
- !visible ? nil : content_tag('li', link_to(name, url), class: active_for_controller(controller))
- end
-
- def active_for_controller(controller)
- if current_controller == controller
- 'active'
- else
- ''
- end
- end
-
- def current_controller
- params[:controller]
- end
end
diff --git a/app/helpers/ingredients_helper.rb b/app/helpers/ingredients_helper.rb
index e2c8b6e..58448ab 100644
--- a/app/helpers/ingredients_helper.rb
+++ b/app/helpers/ingredients_helper.rb
@@ -1,11 +1,4 @@
module IngredientsHelper
- def ndbn_button_class(ingredient)
- if ingredient.ndbn.present?
- 'btn btn-success'
- else
- 'btn btn-default'
- end
- end
end
diff --git a/app/helpers/recipes_helper.rb b/app/helpers/recipes_helper.rb
index a9417fc..83710ba 100644
--- a/app/helpers/recipes_helper.rb
+++ b/app/helpers/recipes_helper.rb
@@ -1,71 +1,3 @@
module RecipesHelper
- def recipe_time(recipe)
- output = ''.html_safe
- if recipe.total_time.present?
- output << "#{humanize_seconds(recipe.total_time.to_i.minutes)}"
- if recipe.active_time.present?
- output << " (#{humanize_seconds(recipe.active_time.to_i.minutes)} active)"
- end
- elsif recipe.active_time.present?
- output << humanize_seconds(recipe.active_time.to_i.minutes)
- end
-
- output
- end
-
- def humanize_seconds(secs)
- [[60, :s], [60, :m], [24, :h], [1000, :d]].map{ |count, name|
- if secs > 0
- secs, n = secs.divmod(count)
- n == 0 ? nil : "#{n.to_i} #{name}"
- end
- }.compact.reverse.join(' ')
- end
-
- def nutrient_row(recipe, nutrients, heading, nutrient_name)
- content_tag('tr') do
- [
- content_tag('td', heading),
- recipe.parsed_yield ? content_tag('td', nutrients.send("#{nutrient_name}_per".to_sym, recipe.parsed_yield.number)) : nil,
- content_tag('td', nutrients.send("#{nutrient_name}".to_sym))
- ].compact.join("\n".html_safe).html_safe
- end
- end
-
- def index_sort_header(text, field, criteria)
- uri = URI(request.original_fullpath)
- query = Rack::Utils.parse_query(uri.query)
-
- directions = [:asc, :desc]
-
- current_field = criteria.sort_column
- current_direction = criteria.sort_direction
- field_param = 'criteria[sort_column]'
- direction_param = 'criteria[sort_direction]'
-
- if request.get?
- is_sorted = current_field == field.to_sym
-
- if is_sorted && directions.include?(current_direction)
- direction = (directions.reject { |d| d == current_direction }).first
- else
- direction = directions.first
- end
-
- if is_sorted && direction == :asc
- link_class = 'sorted desc'
- elsif is_sorted && direction == :desc
- link_class = 'sorted asc'
- else
- link_class = 'sorted'
- end
-
- query[field_param.to_s] = field.to_s
- query[direction_param.to_s] = direction.to_s
- link_to text, "#{uri.path}?#{query.to_query}", class: link_class
- else
- text
- end
- end
end
diff --git a/app/views/admin/users/edit.html.erb b/app/views/admin/users/edit.html.erb
deleted file mode 100644
index e69de29..0000000
diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb
deleted file mode 100644
index 3dbeae3..0000000
--- a/app/views/admin/users/index.html.erb
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-
-
- <% if @users.empty? %>
-
No Users
- <% else %>
-
-
-
-
- Name |
- Username |
- Email |
- Admin |
- |
-
-
-
-
- <% @users.each do |user| %>
-
- <%= link_to user.full_name, edit_admin_user_path(user) %> |
- <%= user.username %> |
- <%= user.email %> |
- <%= user.admin? %> |
-
- <%= link_to [:admin, user], method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-sm btn-danger' do %>
-
- <% end %>
- |
-
- <% end %>
-
-
- <% end %>
-
-
-
-
diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb
deleted file mode 100644
index e69de29..0000000
diff --git a/app/views/calculator/index.html.erb b/app/views/calculator/index.html.erb
deleted file mode 100644
index f057314..0000000
--- a/app/views/calculator/index.html.erb
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
- <%= label_tag :input, "Input", class: 'control-label' %>
- <%= text_field_tag :input, nil, class: 'form-control', autofocus: true %>
-
-
- <%= label_tag :output_unit, "Output Unit", class: 'control-label' %>
- <%= text_field_tag :output_unit, nil, class: 'form-control' %>
-
-
-
- <%= label_tag :ingredient, "Ingredient", class: 'control-label' %>
- <%= text_field_tag :ingredient, nil, class: 'form-control' %>
-
-
-
- <%= label_tag :density, "Density", class: 'control-label' %>
- <%= text_field_tag :density, nil, class: 'form-control' %>
-
-
-
- <%= label_tag :output, "Output", class: 'control-label' %>
- <%= text_field_tag :output, nil, class: 'form-control', readonly: true %>
-
-
-
-
-
-
-
-
diff --git a/app/views/ingredients/_form.html.erb b/app/views/ingredients/_form.html.erb
deleted file mode 100644
index af4f632..0000000
--- a/app/views/ingredients/_form.html.erb
+++ /dev/null
@@ -1,151 +0,0 @@
-
-<% has_ndbn = @ingredient.ndbn.present? %>
-
-<%= form_for(@ingredient, html: {id: 'ingredient_form'}) do |f| %>
-
- <%= render partial: 'shared/error_list', locals: {model: @ingredient} %>
-
- <%= f.hidden_field :ndbn, class: 'ndbn' %>
- <%= f.hidden_field :id, class: 'id', disabled: true %>
-
-
- <%= f.label :name, class: 'control-label' %>
- <%= f.text_field :name, class: 'form-control name', autofocus: true %>
-
-
-
-
-
-
-
-
- <%= f.label :density, class: 'control-label' %>
- <%= f.text_field :density, class: 'form-control', disabled: has_ndbn %>
-
-
-
-
-
Ingredient Units
-
-
-
- <%= f.fields_for :ingredient_units do |iu_form| %>
- <%= render partial: 'ingredients/ingredient_unit_fields', locals: {f: iu_form } %>
- <% end %>
-
- <%= link_to_add_association 'add unit', f, :ingredient_units, class: 'btn btn-primary' %>
-
-
-
-
- <% if has_ndbn %>
-
-
-
-
NDBN Unit Weights
-
-
-
-
-
- Name |
- Grams |
-
-
- <% @ingredient.usda_food.usda_food_weights.each do |w| %>
-
- <%= "#{w.amount} #{w.description}" %> |
- <%= w.gram_weight %> |
-
- <% end %>
-
-
-
-
- <% end %>
-
-
- <%= f.label :notes, class: 'control-label' %>
- <%= f.text_area :notes, class: 'form-control' %>
-
-
-
-
-
Nutrition Per 100 grams
-
-
-
-
-
-
-
- <%= f.submit class: 'btn btn-primary' %>
-
-
-<% end %>
diff --git a/app/views/ingredients/_ingredient_unit_fields.html.erb b/app/views/ingredients/_ingredient_unit_fields.html.erb
deleted file mode 100644
index 804bbf8..0000000
--- a/app/views/ingredients/_ingredient_unit_fields.html.erb
+++ /dev/null
@@ -1,22 +0,0 @@
-
-
-
- <%= f.label :name, class: 'control-label' %>
- <%= f.text_field :name, class: 'form-control' %>
-
-
-
- <%= f.label :gram_weight, 'Grams', class: 'control-label' %>
- <%= f.text_field :gram_weight, class: 'form-control' %>
-
-
-
-
-
\ No newline at end of file
diff --git a/app/views/ingredients/edit.html.erb b/app/views/ingredients/edit.html.erb
deleted file mode 100644
index 9e14d8a..0000000
--- a/app/views/ingredients/edit.html.erb
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
Editing Ingredient
-
- <%= render 'form' %>
-
- <%= link_to 'Back', ingredients_path, class: 'btn btn-default' %>
-
-
-
\ No newline at end of file
diff --git a/app/views/ingredients/index.html.erb b/app/views/ingredients/index.html.erb
deleted file mode 100644
index 1639e4c..0000000
--- a/app/views/ingredients/index.html.erb
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
- <% if @ingredients.empty? %>
-
No Ingredients
- <% else %>
-
- <% if current_user? %>
- <%= link_to 'New Ingredient', new_ingredient_path, class: 'btn btn-default' %>
- <% end %>
-
-
-
-
-
-
- Name |
- USDA |
- KCal per 100g |
- Density (oz/cup) |
- <% if current_user? %>
- |
- <% end %>
-
-
-
-
- <% decorate(@ingredients, IngredientDecorator).each do |ingredient| %>
-
- <%= link_to_if current_user?, ingredient.name, edit_ingredient_path(ingredient) %> |
- <%= ingredient.ndbn_check %> |
- <%= ingredient.kcal %> |
- <%= ingredient.density %> |
- <% if current_user? %>
-
- <%= link_to ingredient, method: :delete, data: { confirm: 'Are you sure?' }, class: 'btn btn-xs btn-danger' do %>
-
- <% end %>
- |
- <% end %>
-
- <% end %>
-
-
- <% end %>
-
-
-
- <% if current_user? %>
- <%= link_to 'New Ingredient', new_ingredient_path, class: 'btn btn-default' %>
- <% end %>
-
-
-
-
diff --git a/app/views/ingredients/new.html.erb b/app/views/ingredients/new.html.erb
deleted file mode 100644
index 2262b48..0000000
--- a/app/views/ingredients/new.html.erb
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
New Ingredient
-
- <%= render 'form' %>
-
- <%= link_to 'Back', ingredients_path, class: 'btn btn-primary' %>
-
-
-
diff --git a/app/views/ingredients/select_ndbn.js.erb b/app/views/ingredients/select_ndbn.js.erb
deleted file mode 100644
index 4eb7e32..0000000
--- a/app/views/ingredients/select_ndbn.js.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-
-$("#ingredient_form").replaceWith($("<%= escape_javascript(render(partial: 'ingredients/form')) %>"));
-window.INGREDIENT_API.initialize();
\ No newline at end of file
diff --git a/app/views/ingredients/usda_food_search.html.erb b/app/views/ingredients/usda_food_search.html.erb
deleted file mode 100644
index d8db16a..0000000
--- a/app/views/ingredients/usda_food_search.html.erb
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
- |
- per 100 grams |
-
-
- NDBN |
- Name |
- KCal |
- Carbs |
- Sugar |
-
-
-
-<% @foods.each do |f| %>
-
-
- <%= f.ndbn %> |
- <%= link_to f.long_description, '#', class: 'food_result', data: {ndbn: f.ndbn} %> |
- <%= f.kcal %> |
- <%= f.carbohydrates %> |
- <%= f.sugar %> |
-
-
-<% end %>
-
-
\ No newline at end of file
diff --git a/app/views/kaminari/_first_page.html.erb b/app/views/kaminari/_first_page.html.erb
deleted file mode 100644
index bf23ff0..0000000
--- a/app/views/kaminari/_first_page.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-
- <%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
-
diff --git a/app/views/kaminari/_gap.html.erb b/app/views/kaminari/_gap.html.erb
deleted file mode 100644
index 6d3a149..0000000
--- a/app/views/kaminari/_gap.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-
- <%= content_tag :a, raw(t 'views.pagination.truncate') %>
-
diff --git a/app/views/kaminari/_last_page.html.erb b/app/views/kaminari/_last_page.html.erb
deleted file mode 100644
index fb619ea..0000000
--- a/app/views/kaminari/_last_page.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-
- <%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
-
diff --git a/app/views/kaminari/_next_page.html.erb b/app/views/kaminari/_next_page.html.erb
deleted file mode 100644
index 15e10e4..0000000
--- a/app/views/kaminari/_next_page.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-
- <%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
-
diff --git a/app/views/kaminari/_page.html.erb b/app/views/kaminari/_page.html.erb
deleted file mode 100644
index 8028b45..0000000
--- a/app/views/kaminari/_page.html.erb
+++ /dev/null
@@ -1,9 +0,0 @@
-<% if page.current? %>
-
- <%= content_tag :a, page, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %>
-
-<% else %>
-
- <%= link_to page, url, remote: remote, rel: (page.next? ? 'next' : (page.prev? ? 'prev' : nil)) %>
-
-<% end %>
diff --git a/app/views/kaminari/_paginator.html.erb b/app/views/kaminari/_paginator.html.erb
deleted file mode 100644
index 2c8757b..0000000
--- a/app/views/kaminari/_paginator.html.erb
+++ /dev/null
@@ -1,15 +0,0 @@
-<%= paginator.render do -%>
-
-<% end -%>
diff --git a/app/views/kaminari/_prev_page.html.erb b/app/views/kaminari/_prev_page.html.erb
deleted file mode 100644
index d94a50a..0000000
--- a/app/views/kaminari/_prev_page.html.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-
- <%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
-
diff --git a/app/views/layouts/_flash_messages.html.erb b/app/views/layouts/_flash_messages.html.erb
deleted file mode 100644
index e4e8932..0000000
--- a/app/views/layouts/_flash_messages.html.erb
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
- <% flash.each do |type, values| %>
- <% Array.wrap(values).each do |value| %>
-
<%= value %>
- <% end %>
- <% end %>
-
-
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index e4e688b..7ad8e82 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -9,40 +9,11 @@
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
-
-
<%= csrf_meta_tags %>
-
-
-<%= render partial: 'layouts/flash_messages' %>
@@ -50,18 +21,6 @@
-
-
-
-
-
-
-
-
-
-
-<%= yield(:page_bottom) %>
-