Created
December 8, 2018 23:19
-
-
Save staycreativedesign/bbb99b5d1c5da5c209b79e21ea6a624a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
.col-sm-4 | |
= f.label :subcategory_id | |
= f.select "subcategory_id", @submenu.subcategories.collect { |o| [ o.title, o.id ] } | |
%button.btn.btn-secondary{"data-target" => "#createsubcategory", "data-toggle" => "modal", :type => "button"} | |
Create Subcategory | |
$('#post_subcategory_id').on('change', function(e){ | |
console.log("I caught the change of the subcategory") | |
var subcatVal = $(this).val(); | |
var category = $(this).closest("form").find("#post_category_id").val(); | |
var submenu = $(this).closest("form").find("#post_submenu_id").val(); | |
$('#new_post').attr('action', '/admin/categories/' + category + "/submenus/" + submenu + '/subcategories/' + subcatVal + '/posts') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment