mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
refactor wysiwyg
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
angular.module("admin.enterprises")
|
||||
.controller "enterpriseCtrl", ($scope, Enterprise, PaymentMethods, ShippingMethods) ->
|
||||
.controller "enterpriseCtrl", ($scope, Enterprise, longDescription, PaymentMethods, ShippingMethods) ->
|
||||
$scope.Enterprise = Enterprise.enterprise
|
||||
$scope.PaymentMethods = PaymentMethods.paymentMethods
|
||||
$scope.ShippingMethods = ShippingMethods.shippingMethods
|
||||
$scope.htmlVariable = Enterprise.enterprise.long_description
|
||||
|
||||
$scope.htmlVariable = longDescription
|
||||
|
||||
for payment_method in $scope.PaymentMethods
|
||||
payment_method.selected = payment_method.id in $scope.Enterprise.payment_method_ids
|
||||
|
||||
@@ -211,7 +211,7 @@ table#listing_enterprise_groups {
|
||||
}
|
||||
|
||||
// textAngular wysiwyg
|
||||
.text-angular .btn-group {
|
||||
text-angular .btn-group {
|
||||
display: inline;
|
||||
margin-right: 8px;
|
||||
button {
|
||||
|
||||
@@ -41,6 +41,10 @@ module Admin
|
||||
render partial: "admin/json/injection_ams", locals: {ngModule: 'ofn.admin', name: 'SpreeApiKey', json: "'#{@spree_api_key.to_s}'"}
|
||||
end
|
||||
|
||||
def admin_inject_enterprise_long_description
|
||||
render partial: "admin/json/injection_ams", locals: {ngModule: 'admin.enterprises', name: 'longDescription', json: "'#{@enterprise.long_description.to_s}'"}
|
||||
end
|
||||
|
||||
|
||||
def admin_inject_json_ams(ngModule, name, data, serializer, opts = {})
|
||||
json = serializer.new(data).to_json
|
||||
|
||||
@@ -187,11 +187,9 @@
|
||||
-# ['bold', 'italics', 'underline', 'strikeThrough', 'ul', 'ol', 'redo', 'undo', 'clear'],
|
||||
-# ['justifyLeft','justifyCenter','justifyRight','indent','outdent'],
|
||||
-# ['html', 'insertImage', 'insertLink', 'insertVideo']
|
||||
%text-angular{'ng-model' => 'htmlVariable', 'class' => 'text-angular',
|
||||
%text-angular{'ng-model' => 'htmlVariable', 'id' => 'enterprise_long_description', 'name' => 'enterprise[long_description]', 'class' => 'text-angular',
|
||||
'ta-toolbar' => "[['h1','h2','h3','h4','p'],['bold','italics','underline','clear'],['insertLink']]",
|
||||
'placeholder' => 'Tell customers about yourself. This information appears on your public profile.'}
|
||||
-# Use a hidden rails form field bound to the textAngular wysiwit field above, using the htmlVariable model. So rails knows to save it.
|
||||
= f.text_area :long_description, rows: 6, 'ng-model' => 'htmlVariable', 'hidden' => 'true'
|
||||
%fieldset.eleven.columns.alpha.no-border-bottom
|
||||
%legend IMAGES
|
||||
.row
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
= admin_inject_enterprise
|
||||
= admin_inject_enterprise_long_description
|
||||
= admin_inject_payment_methods
|
||||
= admin_inject_shipping_methods
|
||||
|
||||
|
||||
Reference in New Issue
Block a user