Skip to content

Commit

Permalink
Only allow images to get connected to articles, issue #48
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjonsson committed Jul 22, 2014
1 parent 1241143 commit 92a0d1f
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion arlima.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin URI: https://github.com/victorjonsson/Arlima
Description: Manage the order of posts on your front page, or any page you want. This is a plugin suitable for online newspapers that's in need of a fully customizable front page.
Author: VK (<a href="http://twitter.com/chredd">@chredd</a>, <a href="http://twitter.com/znoid">@znoid</a>, <a href="http://twitter.com/victor_jonsson">@victor_jonsson</a>, <a href="http://twitter.com/lefalque">@lefalque</a>)
Version: 3.0.beta.42
Version: 3.0.beta.43
License: GPL2
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
Expand Down
3 changes: 2 additions & 1 deletion classes/AbstractAdminPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ public function enqueueScripts()
'preview' => __('Preview list', 'arlima'),
'future' => __('Future post', 'arlima'),
'insertImage' => __('Add to article', 'arlima'),
'noPostsFound' => __('No posts found', 'arlima')
'noPostsFound' => __('No posts found', 'arlima'),
'onlyImages' => __('You can only add images to articles', 'arlima')
)
)
);
Expand Down
2 changes: 1 addition & 1 deletion constants.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
or define('ARLIMA_COMPILE_LESS_IN_BROWSER', ARLIMA_DEV_MODE);

// Plugin version (only edit this via grunt!)
define('ARLIMA_FILE_VERSION', '3.0.beta.42' .(ARLIMA_DEV_MODE ? '__'.time():''));
define('ARLIMA_FILE_VERSION', '3.0.beta.43' .(ARLIMA_DEV_MODE ? '__'.time():''));

// Which type of tag to use for images in Arlima RSS feeds
defined('ARLIMA_RSS_IMG_TAG')
Expand Down
4 changes: 2 additions & 2 deletions js/arlima/arlima.js

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions js/arlima/dev/ArlimaImageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,17 @@ var ArlimaImageManager = (function($, window, ArlimaArticleForm, ArlimaTemplateL
var attachment = window.wpMediaModal.state().get('selection').first().toJSON(),
connected = postID ? true:false;

if( postID && !attachment.uploadedTo ) {
// Not connected via upload
ArlimaBackend.connectAttachmentToPost(attachment, attachment.id);
}
if( !window.ArlimaUtils.isImagePath(attachment.url) ) {
alert(window.ArlimaJS.lang.onlyImages);
} else {

_this.setNewImage(attachment.url, attachment.id, connected);
if( postID && !attachment.uploadedTo ) {
// Not connected via upload
ArlimaBackend.connectAttachmentToPost(attachment, attachment.id);
}

_this.setNewImage(attachment.url, attachment.id, connected);
}
});

// Finally, open the modal
Expand Down
Binary file modified lang/arlima-sv_SE.mo
Binary file not shown.
5 changes: 4 additions & 1 deletion lang/arlima.pot
Original file line number Diff line number Diff line change
Expand Up @@ -654,4 +654,7 @@ msgid "This field can only contain numbers"
msgstr "Du måste ange en siffra."

msgid "This field can not be empty"
msgstr "Det här fältet kan inte lämnas tomt."
msgstr "Det här fältet kan inte lämnas tomt."

msgid "You can only add images to articles"
msgstr "Du kan endast koppla en bild till artikeln"
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Contributors: @chredd, @znoid, @victor_jonsson, @lefalque, @aaslun
Tags: CMS, e-paper, e-magazine, magazine, newspaper, front page, wysiwyg
Requires at least: 3.8
Tested up to: 3.9.1
Stable tag: 3.0.beta.42
Stable tag: 3.0.beta.43
License: GPL2
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down

0 comments on commit 92a0d1f

Please sign in to comment.