Skip to content

Commit

Permalink
Merge branch 'release/5.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenaramonda committed Feb 24, 2018
2 parents 4f30f7b + bcbbdf1 commit b7711a9
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 21 deletions.
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
# Instagram widget #

Magento module 2 that displays last photos from an instagram account. More information here https://www.bitbull.it/blog/sviluppare-un-widget-con-magento2-e-requirejs/
Magento module 2 that displays last photos from an Instagram account. More information here https://www.bitbull.it/blog/sviluppare-un-widget-con-magento2-e-requirejs/

Installation Instructions
--------------------------
Add these lines to the composer.json of your project

```
"require":{
"require": {
...
"bitbull/magento2-module-instagramwidget": "4.2.0"
"bitbull/magento2-module-instagramwidget": "5.0.0"
}
```

```
"repositories":[
"repositories": [
...
{"type": "vcs", "url":"https://github.com/bitbull-team/magento2-module-instagramwidget.git"}
{
"type": "vcs",
"url":"https://github.com/bitbull-team/magento2-module-instagramwidget.git"
}
]
```

Settings
--------

After install go to M2 admin configuration and in the instagram widget tab add:
After install go to M2 admin configuration and in the Bitbull > Instagram widget tab add:
* Instagram Token Credentials
* Instagram Userid Credentials
* Channel name to display
* Numbers of photo

To retrieve the data of your channel follow the official instagram doc: https://www.instagram.com/developer/authentication/
To retrieve the data of your channel follow the official Instagram doc: https://www.instagram.com/developer/authentication/

Changelog
----------

* 5.0.0 - Moved module under Bitbull tab and moved img getter in a separate function
* 4.3.1 - Fix on comparison operator
* 4.3.0 - Fix squared images url
* 4.2.0 - Squared image configuration
Expand All @@ -56,7 +60,8 @@ Licence
Developers
---------

Irene Iaccio(@nuovecode): http://www.bitbull.it
Irene Iaccio(@nuovecode): http://www.bitbull.it
Lorena Ramonda (@loreenaramonda): http://www.bitbull.it

Rodrigo Acuna: https://github.com/rodde177

Expand Down
13 changes: 12 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@
{
"name": "Irene Iaccio",
"email": "[email protected]"
},
{
"name": "Lorena Ramonda",
"email": "[email protected]"
}
],
"repositories":[
{
"type": "vcs",
"url":"[email protected]:bitbull-team/magento2-module-bitbull-common.git"
}
],
"require": {
"php": "~5.5.0|~5.6.0|~7.0.0"
"php": "~5.5.0|~5.6.0|~7.0.0",
"bitbull/common": "*"
},
"type": "magento2-module",
"autoload": {
Expand Down
11 changes: 5 additions & 6 deletions etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system>
<tab id="instagram" translate="label" sortOrder="4001">
<label>Instagram Widget</label>
<tab id="bitbull" translate="label" sortOrder="200">
<label><![CDATA[<span class='bitbull-logo'>Bitbull</span>]]></label>
</tab>

<section id="instagram" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Settings</label>
<tab>instagram</tab>
<section id="bitbull_instagramwidget" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Instagram Widget</label>
<tab>bitbull</tab>
<resource>Magento_Config::config_admin</resource>
<group id="settings" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Settings</label>
Expand Down
1 change: 1 addition & 0 deletions etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<module name="Bitbull_InstagramWidget" setup_version="1.0.0">
<sequence>
<module name="Magento_Cms"/>
<module name="Bitbull_Common"/>
</sequence>
</module>
</config>
2 changes: 1 addition & 1 deletion view/frontend/layout/cms_index_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<block class="Bitbull\InstagramWidget\Block\Instagram"
name="instagram.widget"
template="Bitbull_InstagramWidget::instagram-widget.phtml"
ifconfig="instagram/settings/enabled_homepage">
ifconfig="bitbull_instagramwidget/settings/enabled_homepage">
<arguments>
<argument translate="true" name="title" xsi:type="string">Instagram</argument>
</arguments>
Expand Down
1 change: 1 addition & 0 deletions view/frontend/web/css/source/_module.less
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
padding: 15px;
width: 50%;
float: left;
box-sizing: border-box;
a {
cursor: pointer;
&:hover {
Expand Down
26 changes: 21 additions & 5 deletions view/frontend/web/js/InstagramWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ define([
that = this;

$.each(data.data, function () {
var img = this.images.low_resolution.url,
var img = that._getImg(this),
url = this.link;

if (that.options.cropped_images == 1) {
img = that._getSquaredPhoto(this.images.thumbnail.url);
}

html += '<li>' +
'<a TARGET="_blank" href="' + url +'">' +
'<img src=" '+ img +'"/>'+
Expand All @@ -61,6 +57,26 @@ define([

},

/**
* Get Photo
*
* @param data
* @returns {*}
* @private
*/


_getImg: function (data) {
var that = this,
image = data.images.low_resolution.url;

if (that.options.cropped_images == 1) {
image = that._getSquaredPhoto(data.images.thumbnail.url);
}

return image;
},

/**
* Get Squared Photo if config
*
Expand Down

0 comments on commit b7711a9

Please sign in to comment.