8000 Review changes for blog-fixes · causecode/static-content@de10f1b · GitHub
[go: up one dir, main page]

Skip to content

Commit de10f1b

Browse files
committed
Review changes for blog-fixes
1 parent a9a905f commit de10f1b

File tree

5 files changed

+27
-12
lines changed

5 files changed

+27
-12
lines changed

grails-app/controllers/com/cc/content/page/PageController.groovy

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,24 @@ class PageController {
102102
return
103103
}
104104

105+
// Check if a subject parameter is coming in request if yes, then use that an email subject
106+
String subject = params.subject
107+
if (subject && pageInstance.body.contains("mailto:jobs@causecode.com")) {
108+
pageInstance.body = pageInstance.body.replaceAll("subject=.*?\"", "subject=$subject\"")
109+
}
110+
105111
if (request.xhr) {
106112
respond(pageInstance)
107113
return
108114
}
109115

110116
String pageShowUrl = grailsApplication.config.app.defaultURL + "/page/show/${pageInstance.id}"
111-
redirect(url: pageShowUrl, permanent: true)
117+
118+
if (subject) {
119+
pageShowUrl += "?subject=$subject"
120+
}
121+
122+
redirect(url: pageShowUrl, permanent: true, params: params)
112123
}
113124

114125
def edit(Page pageInstance) {

web-app/ng/app/scripts/blog/blog.controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,6 @@ controllers.controller('BlogController', ['$scope', '$state', 'BlogModel', 'appS
171171
}
172172

173173
$scope.showMarkdownHelp = function() {
174-
$window.open("http://daringfireball.net/projects/markdown/syntax", "_blank");
174+
$window.open("http://daringfireball.net/projects/markdown/syntax");
175175
};
176176
}]);

web-app/ng/app/scripts/page/page.controller.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
'use strict';
44

5-
controllers.controller('PageController', ['$scope', 'PageModel','PageLayoutModel', '$state', 'appService',
6-
function($scope, PageModel, PageLayoutModel, $state, appService) {
5+
controllers.controller('PageController', ['$scope', 'PageModel','PageLayoutModel', '$state', 'appService', '$location',
6+
function($scope, PageModel, PageLayoutModel, $state, appService, $location) {
7+
8+
var subject = $location.search().subject;
79

810
function getPageModelInstance() {
9-
PageModel.get({id: $scope.id}, function(pageInstance) {
11+
PageModel.get({id: $scope.id, subject: subject}, function(pageInstance) {
1012
$scope.pageInstance = pageInstance;
1113
}, function(resp) {
1214
// Redirecting to Home state with alert on Error.

web-app/ng/app/views/blog/show.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ <h2 class="title">Comments</h2>
4141
</div>
4242
</article>
4343
</div>
44-
<div class="blog-entry section col-md-8 col-sm-8 col-xs-12" ng-if="!blogInstance"></div>
44+
<div class="blog-entry section col-md-8 col-sm-8 col-xs-12" ng-if="!blogInstance">
45+
<span>Blog not found.</span>
46+
</div>
4547
<div ng-include src="'views/blog/_filter.html'"></div>
4648
</div>
4749
</div>

web-app/ng/app/views/content/_form.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
<div class="form-group">
1+
<div class="row form-group">
22
<label class="col-sm-3 control-label" for="title">Title</label>
33
<div class="col-sm-4">
44
<input id="body" type="text" class="form-control" placeholder="Enter Title" autofocus
55
ng-model="contentInstance.title">
66
</div>
77
</div>
88

9-
<div class="form-group">
9+
<div class="row form-group">
1010
<label class="col-sm-3 control-label" for="subTitle">Sub Title</label>
1111
<div class="col-sm-4">
1212
<input id="subTitle" type="text" class="form-control" placeholder="Enter Sub Title"
1313
ng-model="contentInstance.subTitle">
1414
</div>
1515
</div>
1616

17-
<div class="form-group">
17+
<div class="row form-group">
1818
<label class="col-sm-3 control-label" for="editorType">Editor Type</label>
1919
<div class="col-sm-4">
2020
<select id="editorType" ng-model="editorType" class="form-control">
@@ -25,7 +25,7 @@
2525
</div>
2626
</div>
2727

28-
<div class="form-group" ng-show="!editorType || editorType === 'tinymce'">
28+
<div class="row form-group" ng-show="!editorType || editorType === 'tinymce'">
2929
<label class="col-sm-3 control-label">Body</label>
3030
<div class="col-sm-8">
3131
<textarea ui-tinymce="tinymceOptions" class="form-control" ng-model="contentInstance.body"></textarea>
@@ -34,7 +34,7 @@
3434

3535
<div class="form-group" ng-show="editorType && editorType === 'markdown'">
3636
<label class="col-sm-3 control-label" style="margin-top: 25px;">Markdown Body</label>
37-
<div class="col-sm-9" style="margin-bottom: 30px; padding-left: 0; padding-right: 0;">
37+
<div class="col-sm-9 padding-left-z padding-right-z" style="margin-bottom: 30px;">
3838
<pagedown-editor content="contentInstance.body" placeholder="Enter Markdown text" help="showMarkdownHelp()"
3939
show-preview="false" insert-image=""></pagedown-editor>
4040
</div>
@@ -46,7 +46,7 @@
4646

4747
<div class="form-group" ng-show="editorType && editorType === 'rawContent'">
4848
<label class="col-sm-3 control-label">Raw Body</label>
49-
<div class="col-sm-9" style="margin-bottom: 30px; padding-left: 0; padding-right: 0;">
49+
<div class="col-sm-9 padding-left-z padding-right-z" style="margin-bottom: 30px;">
5050
<textarea class="form-control color-text-area" style="height: 300px;" ng-model="contentInstance.body"
5151
rows="12"></textarea>
5252
</div>

0 commit comments

Comments
 (0)
0