refactor wysiwyg

This commit is contained in:
Rafael Schouten
2014-10-01 16:07:10 +10:00
parent 726340fc86
commit 3a14a26bc6
5 changed files with 9 additions and 7 deletions

View File

@@ -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

View File

@@ -211,7 +211,7 @@ table#listing_enterprise_groups {
}
// textAngular wysiwyg
.text-angular .btn-group {
text-angular .btn-group {
display: inline;
margin-right: 8px;
button {

View File

@@ -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

View File

@@ -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

View File

@@ -1,4 +1,5 @@
= admin_inject_enterprise
= admin_inject_enterprise_long_description
= admin_inject_payment_methods
= admin_inject_shipping_methods