Commit eed980d7 authored by Christoph Thelen's avatar Christoph Thelen

Fixed delete button not showing for freetext

parent 97d8f6af
<project name="ARSnova" default="run">
<property name="main.dir" value="src/main/webapp" />
<property name="sencha.build.dir" value="${main.dir}/build" />
<property name="sencha.build.testing.dir" value="${sencha.build.dir}/testing/ARSnova" />
<property name="sencha.build.production.dir" value="${sencha.build.dir}/production/ARSnova" />
<taskdef name="jshint" classname="com.philmander.jshint.JsHintAntTask" classpath="${basedir}/lib/ant-jshint-0.3.6-SNAPSHOT-deps.jar" />
<target name="sencha:refresh">
<exec executable="sencha" dir="${main.dir}" failonerror="true">
<arg value="app"/>
<arg value="refresh"/>
</exec>
</target>
<target name="sencha:build:testing">
<exec executable="sencha" dir="${main.dir}" failonerror="true">
<arg value="app"/>
<arg value="build"/>
<arg value="testing"/>
</exec>
</target>
<target name="sencha:build:production">
<exec executable="sencha" dir="${main.dir}" failonerror="true">
<arg value="app"/>
<arg value="build"/>
<arg value="production"/>
</exec>
</target>
<target name="sencha:app:watch">
<exec executable="sencha" dir="${main.dir}" failonerror="true">
<arg value="app"/>
<arg value="watch"/>
</exec>
</target>
<target name="jshint">
<jshint dir="${main.dir}/app" includes="**/*.js" globals="Ext:true,console:true,ARSnova:true,socket:true,RSVP:true">
<report type="xml" destFile="${basedir}/target/jshint.xml" />
</jshint>
</target>
<target name="run" depends="sencha:refresh, sencha:build:production"/>
</project>
\ No newline at end of file
<project name="ARSnova" default="run">
<property name="main.dir" value="src/main/webapp" />
<property name="sencha.build.dir" value="${main.dir}/build" />
<property name="sencha.build.testing.dir" value="${sencha.build.dir}/testing/ARSnova" />
<property name="sencha.build.production.dir" value="${sencha.build.dir}/production/ARSnova" />
<property name="environment" value="production" />
<taskdef name="jshint" classname="com.philmander.jshint.JsHintAntTask" classpath="${basedir}/lib/ant-jshint-0.3.6-SNAPSHOT-deps.jar" />
<target name="sencha:refresh">
<exec executable="sencha" dir="${main.dir}" failonerror="true">
<arg value="app"/>
<arg value="refresh"/>
</exec>
</target>
<target name="sencha:build:testing">
<exec executable="sencha" dir="${main.dir}" failonerror="true">
<arg value="app"/>
<arg value="build"/>
<arg value="testing"/>
</exec>
</target>
<target name="sencha:build:production">
<exec executable="sencha" dir="${main.dir}" failonerror="true">
<arg value="app"/>
<arg value="build"/>
<arg value="production"/>
</exec>
</target>
<target name="sencha:app:watch">
<exec executable="sencha" dir="${main.dir}" failonerror="true">
<arg line="app watch -e ${environment}"/>
</exec>
</target>
<target name="jshint">
<jshint dir="${main.dir}/app" includes="**/*.js" globals="Ext:true,console:true,ARSnova:true,socket:true,RSVP:true">
<report type="xml" destFile="${basedir}/target/jshint.xml" />
</jshint>
</target>
<target name="run" depends="sencha:refresh, sencha:build:production"/>
</project>
......@@ -193,12 +193,11 @@ Ext.define("ARSnova.controller.Questions", {
// This gets called either by the speaker or by a student
if (ARSnova.app.isSessionOwner && !isFromFreetextAnswerPanel) {
parentPanel = ARSnova.app.mainTabPanel.tabPanel.speakerTabPanel;
options.answer.deletable = true;
} else {
parentPanel = ARSnova.app.mainTabPanel;
options.answer.deletable = false;
}
options.answer.deletable = ARSnova.app.isSessionOwner;
var freetextDetailAnswerPanel = Ext.create('ARSnova.view.FreetextDetailAnswer', {
sTP : parentPanel,
answer : options.answer
......
......@@ -97,42 +97,24 @@ Ext.define('ARSnova.view.FreetextDetailAnswer', {
scope: this,
hidden: !this.answer.deletable,
handler: function() {
var me = this;
var sheet = Ext.create('Ext.ActionSheet', {
items: [
{
text: Messages.DELETE,
ui: 'decline',
handler: function () {
ARSnova.app.questionModel.deleteAnswer(self.answer.questionId, self.answer._id, {
failure: function() {
console.log('server-side error: deletion of freetext answer failed');
}
});
sheet.destroy();
self.sTP.animateActiveItem(self.sTP.questionDetailsPanel, {
type : 'slide',
direction : 'right',
duration : 700,
listeners: {
animationend: function() {
self.answer.removeItem();
me.destroy();
}, scope: this }
});
}
},
{
text: Messages.CANCEL,
handler: function() {
sheet.hide();
}
}
]
ARSnova.app.questionModel.deleteAnswer(self.answer.questionId, self.answer._id, {
success: function() {
self.sTP.animateActiveItem(self.sTP.questionDetailsPanel, {
type : 'slide',
direction : 'right',
duration : 700,
listeners: {
animationend: function() {
self.answer.removeItem();
me.destroy();
}
}
});
},
failure: function() {
console.log('server-side error: deletion of freetext answer failed');
}
});
Ext.Viewport.add(sheet);
sheet.show();
}
}]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment