From dc67c32aeab21f6ab2c0ca3c0908ce0454341857 Mon Sep 17 00:00:00 2001 From: Amos Folz Date: Sun, 31 Mar 2019 20:25:21 +0000 Subject: [PATCH 1/7] undescribed --- app/sprinkles/admin/assets/userfrosting/js/pages/group.js | 3 +++ app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js | 2 ++ app/sprinkles/admin/templates/forms/group.html.twig | 4 ++-- app/sprinkles/core/asset-bundles.json | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/sprinkles/admin/assets/userfrosting/js/pages/group.js b/app/sprinkles/admin/assets/userfrosting/js/pages/group.js index 66b35b9fc..9bc8f2804 100644 --- a/app/sprinkles/admin/assets/userfrosting/js/pages/group.js +++ b/app/sprinkles/admin/assets/userfrosting/js/pages/group.js @@ -21,4 +21,7 @@ $(document).ready(function() { $("#widget-group-users").on("pagerComplete.ufTable", function () { bindUserButtons($(this)); }); + +$('.icp').iconpicker(); + }); diff --git a/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js b/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js index 47c9d15e7..948fc822d 100644 --- a/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js +++ b/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js @@ -41,6 +41,8 @@ function attachGroupForm() { $(this).prev(".icon-preview").find("i").removeClass().addClass($(this).val()); }); + $('.icp-auto').iconpicker(); + // Set up the form for submission form.ufForm({ validator: page.validators diff --git a/app/sprinkles/admin/templates/forms/group.html.twig b/app/sprinkles/admin/templates/forms/group.html.twig index 36d663239..43d02f42a 100644 --- a/app/sprinkles/admin/templates/forms/group.html.twig +++ b/app/sprinkles/admin/templates/forms/group.html.twig @@ -35,11 +35,11 @@ {% endif %} {% if 'icon' not in fields.hidden %}
-
+
- +
diff --git a/app/sprinkles/core/asset-bundles.json b/app/sprinkles/core/asset-bundles.json index 5dfeac792..0a7e4b3d9 100644 --- a/app/sprinkles/core/asset-bundles.json +++ b/app/sprinkles/core/asset-bundles.json @@ -33,7 +33,8 @@ "js/form-widgets": { "scripts": [ "vendor/speakingurl/speakingurl.min.js", - "userfrosting/js/uf-collection.js" + "userfrosting/js/uf-collection.js", + "vendor/fontawesome-iconpicker/dist/js/fontawesome-iconpicker.js" ], "options": { "result": { From d04a70d82bd5d3ca967bbcbb5c8df540abf0e978 Mon Sep 17 00:00:00 2001 From: Amos Folz <33728190+amosfolz@users.noreply.github.com> Date: Fri, 5 Apr 2019 22:37:45 +0000 Subject: [PATCH 2/7] updated package.json --- app/sprinkles/core/package.json | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/sprinkles/core/package.json b/app/sprinkles/core/package.json index cb2526ebd..188cfe6a3 100644 --- a/app/sprinkles/core/package.json +++ b/app/sprinkles/core/package.json @@ -3,19 +3,20 @@ "dependencies": { "bootstrap": "^3.3.6", "clipboard": "^1.5.16", + "fastclick": "^1.0.6", "font-awesome": "^4.7.0", + "fontawesome-iconpicker": "^3.2.0", "handlebars": "^3.0.3", + "icheck": "^1.0.1", + "ionicons": "^2.0.1", "jquery": "^3.2.1", + "jquery-slimscroll": "~1.3.8", "jquery-ui": "^1.12.0", "jquery-validation": "~1.14.0", - "select2": "^4.0.5", - "tablesorter": "^2.28.5", "moment": "^2.17.1", + "select2": "^4.0.5", "speakingurl": "^11.0.0", - "icheck": "^1.0.1", - "jquery-slimscroll": "~1.3.8", - "fastclick": "^1.0.6", - "ionicons": "^2.0.1", + "tablesorter": "^2.28.5", "urijs": "^1.18.4" } } From b6ad4f10aa15d8ae6c2b3b79e450ffc89ca3f4fc Mon Sep 17 00:00:00 2001 From: Amos Folz <33728190+amosfolz@users.noreply.github.com> Date: Sat, 6 Apr 2019 00:16:29 +0000 Subject: [PATCH 3/7] Add fontawesome-iconpicker package. --- app/sprinkles/admin/templates/forms/group.html.twig | 6 +++--- app/sprinkles/core/asset-bundles.json | 3 ++- app/sprinkles/core/package.json | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/sprinkles/admin/templates/forms/group.html.twig b/app/sprinkles/admin/templates/forms/group.html.twig index 43d02f42a..8e1ac85b3 100644 --- a/app/sprinkles/admin/templates/forms/group.html.twig +++ b/app/sprinkles/admin/templates/forms/group.html.twig @@ -9,7 +9,7 @@
- +
@@ -20,7 +20,7 @@
- + {% if 'slug' not in form.fields.disabled %} @@ -39,7 +39,7 @@
- +
diff --git a/app/sprinkles/core/asset-bundles.json b/app/sprinkles/core/asset-bundles.json index 0a7e4b3d9..dffe1ea5a 100644 --- a/app/sprinkles/core/asset-bundles.json +++ b/app/sprinkles/core/asset-bundles.json @@ -46,7 +46,8 @@ }, "css/main": { "styles": [ - "vendor/font-awesome/css/font-awesome.css", + "vendor/fontawesome-iconpicker/dist/css/fontawesome-iconpicker.css", + "vendor/@fortawesome/fontawesome-free/css/all.css", "vendor/bootstrap/dist/css/bootstrap.css", "vendor/select2/dist/css/select2.css", "vendor/icheck/skins/square/_all.css", diff --git a/app/sprinkles/core/package.json b/app/sprinkles/core/package.json index 188cfe6a3..847ba3faa 100644 --- a/app/sprinkles/core/package.json +++ b/app/sprinkles/core/package.json @@ -1,10 +1,10 @@ { "private": true, "dependencies": { + "@fortawesome/fontawesome-free": "^5.8.1", "bootstrap": "^3.3.6", "clipboard": "^1.5.16", "fastclick": "^1.0.6", - "font-awesome": "^4.7.0", "fontawesome-iconpicker": "^3.2.0", "handlebars": "^3.0.3", "icheck": "^1.0.1", From 754ea753979532ef04896a5c32c500381ff4e6da Mon Sep 17 00:00:00 2001 From: Amos Folz <33728190+amosfolz@users.noreply.github.com> Date: Sat, 6 Apr 2019 00:34:04 +0000 Subject: [PATCH 4/7] Add fontawesome-iconpicker package and update asset-bundle.json --- app/sprinkles/admin/templates/forms/group.html.twig | 4 ++-- app/sprinkles/core/asset-bundles.json | 4 +++- app/sprinkles/core/package.json | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/sprinkles/admin/templates/forms/group.html.twig b/app/sprinkles/admin/templates/forms/group.html.twig index 36d663239..56efb9217 100644 --- a/app/sprinkles/admin/templates/forms/group.html.twig +++ b/app/sprinkles/admin/templates/forms/group.html.twig @@ -35,11 +35,11 @@ {% endif %} {% if 'icon' not in fields.hidden %}
-
+
- +
diff --git a/app/sprinkles/core/asset-bundles.json b/app/sprinkles/core/asset-bundles.json index 5dfeac792..855328abd 100644 --- a/app/sprinkles/core/asset-bundles.json +++ b/app/sprinkles/core/asset-bundles.json @@ -33,7 +33,8 @@ "js/form-widgets": { "scripts": [ "vendor/speakingurl/speakingurl.min.js", - "userfrosting/js/uf-collection.js" + "userfrosting/js/uf-collection.js", + "vendor/fontawesome-iconpicker/dist/js/fontawesome-iconpicker.js" ], "options": { "result": { @@ -45,6 +46,7 @@ }, "css/main": { "styles": [ + "vendor/fontawesome-iconpicker/css/font-awesome.css", "vendor/font-awesome/css/font-awesome.css", "vendor/bootstrap/dist/css/bootstrap.css", "vendor/select2/dist/css/select2.css", diff --git a/app/sprinkles/core/package.json b/app/sprinkles/core/package.json index cb2526ebd..25f5c1cf4 100644 --- a/app/sprinkles/core/package.json +++ b/app/sprinkles/core/package.json @@ -16,6 +16,7 @@ "jquery-slimscroll": "~1.3.8", "fastclick": "^1.0.6", "ionicons": "^2.0.1", - "urijs": "^1.18.4" + "urijs": "^1.18.4", + "fontawesome-iconpicker": "^3.2.0" } } From cf3048126b0855e5c27142e48435f9bfc7b26d71 Mon Sep 17 00:00:00 2001 From: Amos Folz <33728190+amosfolz@users.noreply.github.com> Date: Sat, 6 Apr 2019 00:42:40 +0000 Subject: [PATCH 5/7] Add iconpicker to groups widget --- app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js b/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js index 47c9d15e7..65a2c1df3 100644 --- a/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js +++ b/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js @@ -36,6 +36,9 @@ function attachGroupForm() { } }); + // Fontawesome-iconpicker + $('.icp-auto').iconpicker(); + // Set icon when changed form.find('input[name=icon]').on('input change', function() { $(this).prev(".icon-preview").find("i").removeClass().addClass($(this).val()); From 4006a3878e29d284967ea25c04a2a69ef5ab7207 Mon Sep 17 00:00:00 2001 From: amosfolz <33728190+amosfolz@users.noreply.github.com> Date: Fri, 5 Apr 2019 20:46:51 -0400 Subject: [PATCH 6/7] Fix typo --- app/sprinkles/core/asset-bundles.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/sprinkles/core/asset-bundles.json b/app/sprinkles/core/asset-bundles.json index 855328abd..a5ade3ab5 100644 --- a/app/sprinkles/core/asset-bundles.json +++ b/app/sprinkles/core/asset-bundles.json @@ -46,7 +46,7 @@ }, "css/main": { "styles": [ - "vendor/fontawesome-iconpicker/css/font-awesome.css", + "vendor/fontawesome-iconpicker/dist/css/fontawesome-iconpicker.css", "vendor/font-awesome/css/font-awesome.css", "vendor/bootstrap/dist/css/bootstrap.css", "vendor/select2/dist/css/select2.css", From a98beaccd06472c6caae3859b743eea29acb0498 Mon Sep 17 00:00:00 2001 From: amosfolz <33728190+amosfolz@users.noreply.github.com> Date: Fri, 19 Jul 2019 22:28:16 -0400 Subject: [PATCH 7/7] Add default starcraft icons Validation fails if these are not included. --- .../assets/userfrosting/js/widgets/groups.js | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js b/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js index 5e1ffb879..d2fa7e8ec 100644 --- a/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js +++ b/app/sprinkles/admin/assets/userfrosting/js/widgets/groups.js @@ -6,7 +6,7 @@ * Set up the form in a modal after being successfully attached to the body. */ function attachGroupForm() { - $("body").on('renderSuccess.ufModal', function (data) { + $("body").on('renderSuccess.ufModal', function(data) { var modal = $(this).ufModal('getModal'); var form = modal.find('.js-form'); @@ -37,14 +37,32 @@ function attachGroupForm() { }); // Fontawesome-iconpicker - $('.icp-auto').iconpicker(); + // Starcraft icons + var sc_icons = [{ + title: "sc sc-terran", + searchTerms: ['starcraft', 'terran'] + }, + { + title: "sc sc-zerg", + searchTerms: ['starcraft', 'zerg'] + }, { + title: "sc sc-protoss", + searchTerms: ['starcraft', 'protoss'] + }, + ] + + $('.icp-auto').iconpicker({ + // this is a hacky way to add in our custom icons to the default FA5 icons. + // See https://github.com/farbelous/fontawesome-iconpicker/issues/77 + icons: typeof sc_icons != 'undefined' ? $.merge(sc_icons, $.iconpicker.defaultOptions.icons) : null, + }); // Set icon when changed form.find('input[name=icon]').on('input change', function() { $(this).prev(".icon-preview").find("i").removeClass().addClass($(this).val()); }); - $('.icp-auto').iconpicker(); + $('.icp-auto').iconpicker(); // Set up the form for submission form.ufForm({ @@ -98,16 +116,16 @@ function bindGroupButtons(el, options) { msgTarget: $("#alerts-page") }); - $("body").on('renderSuccess.ufModal', function () { + $("body").on('renderSuccess.ufModal', function() { var modal = $(this).ufModal('getModal'); var form = modal.find('.js-form'); form.ufForm() - .on("submitSuccess.ufForm", function() { - // Navigate or reload page on success - if (options.delete_redirect) window.location.href = options.delete_redirect; - else window.location.reload(); - }); + .on("submitSuccess.ufForm", function() { + // Navigate or reload page on success + if (options.delete_redirect) window.location.href = options.delete_redirect; + else window.location.reload(); + }); }); }); } @@ -124,4 +142,4 @@ function bindGroupCreationButton(el) { attachGroupForm(); }); -}; +}; \ No newline at end of file