admn-module-ekhn
Advanced tools
Comparing version 1.0.14 to 1.0.15
{ | ||
"name": "admn-module-ekhn", | ||
"version": "1.0.14", | ||
"version": "1.0.15", | ||
"description": "Module f�r Kirchenseiten der EKHN", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,3 +6,3 @@ var request = require("request"); | ||
// Url for Glaubensimpuls | ||
var url = "https://api.instagram.com/v1/users/15212360/media/recent?access_token=15212360.1677ed0.bd6094fcaa76441ca8edba05fdecf2f8&count=1"; | ||
var url = "https://api.instagram.com/v1/users/976930779/media/recent?access_token=15212360.097b787.487f1621085943dab87f6c17ea2704d1&count=1"; | ||
@@ -9,0 +9,0 @@ module.exports = function (app) { |
import Axios from 'axios'; | ||
import React, {Component, PropTypes} from 'react'; | ||
import {BlockWrapper, Components} from 'admn'; | ||
const {ImageInfo} = Components; | ||
import {BlockWrapper} from 'admn'; | ||
import {ImageInfo} from 'admn/components'; | ||
@@ -15,65 +15,75 @@ /*@BlockWrapper({ | ||
class Glaubensimpuls extends Component { | ||
static title = 'Glaubensimpuls'; | ||
static category = 'Bild,Kirche'; | ||
static icon = 'cloud'; | ||
static title = 'Glaubensimpuls'; | ||
static category = 'Bild,Kirche'; | ||
static icon = 'cloud'; | ||
constructor() { | ||
super(); | ||
this.state = { | ||
image: null, | ||
error: null | ||
constructor() { | ||
super(); | ||
this.state = { | ||
image: null, | ||
error: null | ||
} | ||
} | ||
} | ||
componentDidMount() { | ||
Axios.get("/api/glaubensimpuls") | ||
.then((response) => { | ||
if (response.data.data) { | ||
this.setState({image: response.data.data[0]}) | ||
} | ||
}) | ||
.catch((response) => { | ||
this.setState({error: response}) | ||
}); | ||
} | ||
componentDidMount() { | ||
Axios.get("/api/glaubensimpuls") | ||
.then((response) => { | ||
console.log(response); | ||
if (response.data.data) { | ||
this.setState({image: response.data.data[0]}) | ||
} | ||
}) | ||
.catch((response) => { | ||
this.setState({error: response}) | ||
}); | ||
} | ||
render() { | ||
const {image, error} = this.state; | ||
const {style, className, onDragStart, draggable} = this.props; | ||
render() { | ||
const {image, error} = this.state; | ||
const {style, className, onDragStart, draggable} = this.props; | ||
if (image && !error) { | ||
var styles = { | ||
width: '100%', | ||
height: '100%', | ||
position: 'relative', | ||
...style | ||
}; | ||
var styles = { | ||
width: '100%', | ||
height: '100%', | ||
position: 'relative', | ||
minHeight: '60px', | ||
backgroundColor: '#DDD', | ||
...style | ||
}; | ||
var imageObject = { | ||
url: image.images.standard_resolution.url, | ||
width: 640, | ||
height: 640, | ||
comment: image.caption.text, | ||
author: <a href={image.link} target="_blank">{image.user['full_name']}</a> | ||
}; | ||
if (image && !error) { | ||
var imageObject = { | ||
url: image.images.standard_resolution.url, | ||
width: 640, | ||
height: 640, | ||
comment: image.caption.text, | ||
author: <a href={image.link} target="_blank">{image.user['full_name']}</a> | ||
}; | ||
return ( | ||
<div style={styles} className={className} contentEditable={false} draggable={draggable} | ||
onDragStart={onDragStart}> | ||
<ImageInfo value={imageObject} width={'100%'} lightbox={true} readOnly={true}/> | ||
</div> | ||
); | ||
} else { | ||
return <span>{error || 'Loading...'}</span> | ||
return ( | ||
<div style={styles} className={className} contentEditable={false} draggable={draggable} | ||
onDragStart={onDragStart}> | ||
<ImageInfo value={imageObject} width={'100%'} lightbox={true} readOnly={true}/> | ||
</div> | ||
); | ||
} else { | ||
return <span>{error || ( | ||
<div style={styles} className={className}> | ||
<div className="ui active inverted dimmer"> | ||
<div className="ui loader"></div> | ||
</div> | ||
</div> | ||
)}</span> | ||
} | ||
} | ||
} | ||
} | ||
var Wrapped = BlockWrapper({ | ||
resizeable: { | ||
resizeSteps: 10, | ||
//ratio: 2/3, | ||
//vertical: 'absolute', | ||
handles: true | ||
} | ||
resizeable: { | ||
resizeSteps: 10, | ||
//ratio: 2/3, | ||
//vertical: 'absolute', | ||
handles: true | ||
} | ||
})(Glaubensimpuls); | ||
@@ -80,0 +90,0 @@ Wrapped.title = 'Glaubensimpuls'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
465179
10347