Skip to content

Commit

Permalink
Fixed editing error.
Browse files Browse the repository at this point in the history
  • Loading branch information
taehoon-kang committed Mar 27, 2012
1 parent b8b1c65 commit 2c3bbd7
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 6 deletions.
6 changes: 4 additions & 2 deletions action/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ def post(self, category_name):

@login_required
def put(self):
params = json.loads(self.request.body)
self._captcha_validation(params['recaptcha_challenge_field'], params['recaptcha_response_field'])
unqouted = urllib.unquote_plus(self.request.body).decode('utf8')
if unqouted[-1:] != '}':
unqouted = unqouted[:-1]
params = json.loads(unqouted)
article_id = int(params['id'])
article = models.Article.get_by_id(article_id)
if article.author.user != users.get_current_user():
Expand Down
2 changes: 1 addition & 1 deletion models.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ def save(self):
soup = BeautifulSoup(self.body)
img = soup.find('img')

if img and hasattr(img, 'src') and re.search('tiny_mce/plugins/emoticons', img['src'].lower()) is None:
if img and hasattr(img, 'src') and re.search('tiny_mce/plugins/emotions', img['src'].lower()) is None:
self.image = img['src']
has_image = True

Expand Down
8 changes: 7 additions & 1 deletion static/css/openalive.css
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ iframe {
padding: 4px;
vertical-align: middle;
clear: both;
overflow: hidden;
border-bottom: 1px solid #eee
}

Expand All @@ -444,9 +445,14 @@ iframe {
float: left;
}

#user-comments li p,#user-articles li .excerpt {
display: table;
}
#user-comments li p,#user-articles li .excerpt,#recent li p {
padding-top: 10px;
display: table;
}
#recent li p {
over-flow: hidden;
}

#user-articles li .excerpt a,#recent li p a {
Expand Down
1 change: 1 addition & 0 deletions static/js/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ var ArticleEditor = (function() {
var open = function() {
initialized ? transferFieldValues() :init();
var edit = isEdit();
$("#post-article-captcha-control-group").toggle(!edit);
if (!edit && !service.Category.getCurrent()) {
$().toastmessage("showWarningToast", gettext("No category selected."));
return false;
Expand Down
2 changes: 1 addition & 1 deletion static/js/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ var initializeModels = function() {
$.ajax({
type: "PUT",
url: "/service/article",
data: JSON.stringify(self.getFormAsJson(form)),
data: encodeURIComponent(JSON.stringify(self.getFormAsJson(form))),
cache: false,
success: function(data) {
self.current = data.article;
Expand Down
1 change: 1 addition & 0 deletions templates/_base/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
</script>
{% js 'js/bootstrap.min.js' %}
{% js 'js/bootbox.min.js' %}
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
<script type="text/javascript" src="/i18n/js"></script>
{% endblock %}
</body>
Expand Down
2 changes: 1 addition & 1 deletion templates/_snippets/post-article.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ <h3>{% trans 'Post an Article' %}</h3>
<p class="help-block">{% trans 'Hit ENTER to add tag. Please do not tag different variations of the same name.' %}</p>
</div>
</div>
<div class="control-group">
<div id="post-article-captcha-control-group" class="control-group">
<label class="control-label" for="recaptcha_response_field">{% trans 'Captcha' %}</label>
<div class="controls">
<div id="article-captcha"></div>
Expand Down

0 comments on commit 2c3bbd7

Please sign in to comment.