Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Resource Geogebra #131

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add Resource Geogebra #131

wants to merge 2 commits into from

Conversation

marisalerno
Copy link
Collaborator

Add Geogebra Resource

Copy link
Owner

@ignaciojonas ignaciojonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Creo que el resto esta bien. Solo ese cambio para que puedan pasar los tests.

@@ -18,6 +18,7 @@
return [
'name' => $faker->word,
'type' => $faker->text,
'link' => $faker->url
'link' => $faker->url,
'geogebra' => $faker->GGBApplet
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esto no funciona, porque no existe en Faker, que genere un id de Geogebra. Lo que se puede hacer aca es poner o un ID fijo de un recurso de geogebra que conozcas. Porque esto nos esta rompiendo los tests.

@if ($resource->type == "Geogebra")
<div id="ggb-element"></div>
<script>
var ggbApp = new GGBApplet({"appName": "graphing", "width": 800, "height": 600, "showToolBar": true, "showAlgebraInput": true, "showMenuBar": true, "material_id":"{$resource->geogebra_id)}" }, true);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aca en appName, vamos a tener que poder modificarlo. Si miras en la ayuda https://wiki.geogebra.org/es/Referencia:Incrustaci%C3%B3n_de_Aplicaciones_GeoGebra dependiendo el recurso que uses, si es uno 3d o uno de graficos o uno de geometria, hay que configurar la app bien. Entonces, deberiamos modificar el recurso para que cuando se selecciona Geogebra, le podamos seleccionar el tipo de app que queremos: graphing a geometry o 3d

app/Resource.php Outdated
@@ -6,5 +6,5 @@

class Resource extends Model
{
protected $fillable = ['name','type', 'path', 'link'];
protected $fillable = ['name','type', 'path', 'link', 'geogebra_id'];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lo que no veo es la migracion que agrega esa columna. Deberiamos, como te comente en otro comentario, agregar ademas una geogebra_app_type para que se pueda guardar el ID del recurso con el tipo de app para mostrarlo bien.

Copy link
Owner

@ignaciojonas ignaciojonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marisalerno Ahi te agregue unos comentarios para guiarte en los pasos que tenes que seguir para hacer anda el recurso de geogebra.
Estas encaminada, pero hay algunos errores.
Fijate bien los comentarios y cualquier cosa me escribir.

Los pasos generales serían:

  • Creas una migracion que agrega 2 campos geogebra_type geogebra_resource
  • Actualizas las seeds y los factories
  • Corres las migraciones
  • Actualizas los templates para que muestren correctamente los campos de la base
  • Actualizas los modelos para que acepten los nuevos campos

Una vez que lo tengas andando vemos de poder meterle algunos tests.

@@ -9,7 +9,8 @@
class ResourceController extends Controller
{

public $types = ['Audio','Video', 'Imagen', 'Documento','Link'];
public $types = ['Audio','Video', 'Imagen', 'Documento','Link', 'Geogebra'];
public $geotypes = ['graphing', 'geometry', '3d'];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Muy bien esto!

@@ -6,5 +6,5 @@

class Resource extends Model
{
protected $fillable = ['name','type', 'path', 'link'];
protected $fillable = ['name','type', 'path', 'link', 'geotype'];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ponele en lugar de geotype, geogebra_type. Para ponerlo en el modelo tenes que crear una migracion. Que va a modificar la tabla Resource y agergar 2 campos.
geogebra_type (este es el que ya tenes)
geogebra_code (est ees el codigo que tiene que poner el docente para que se vea)

en esta linea que esta el comentario tenes que agregar tambien geogebra_code

@@ -18,6 +18,7 @@
return [
'name' => $faker->word,
'type' => $faker->text,
'link' => $faker->url
'link' => $faker->url,
'geotype' => 'ZT6xkDYM'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cambiar por geogebra_type. Aca ese codigo esta mal, lo que es el tipo es 3d, graphing, geometry. osea podes poner cualquiera de esos.
despues pones otro geogebra_code con ese valor.

Justo para ese codigotenes que poner graphing

@@ -19,6 +19,7 @@ public function up()
$table->string('type');
$table->string('path')->nullable();
$table->string('link')->nullable();
$table->string('geotype')->nullable();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esto no lo tenes que hacer aca a pelo, tenes que hacer una migracion nueva
php artisan make:migration add_geogebra_to_resources_table
y adento de esa creas las columnas (hay un ejemplo en el codigo add_record....

Una vez que completaste el up y down de esa migracion ejecutas las migraciones
php artisan migrate

@@ -17,6 +17,7 @@ public function run()
factory(App\Resource::class, 1)->create(['name'=>'presentación', 'type'=>'presentación de diapositivas']);
factory(App\Resource::class, 1)->create(['name'=>'hipervínculo', 'type'=>'hipervínculo']);
factory(App\Resource::class, 1)->create(['name'=>'imagen', 'type'=>'imagen']);
factory(App\Resource::class, 1)->create(['name'=>'ggb-element', 'type'=>'app geogebra']);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name puede ser cualqueir cosa
Type deberia ser Geogebra que es el Type que le ponemos.

@@ -2,6 +2,8 @@

@section('pagespecificscripts')
<script src="{{ asset('js/resources.js') }}"></script>
<script src="https://www.geogebra.org/apps/deployggb.js"></script>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aca no lo necesitamos a esto.

Comment on lines +28 to +33
<script>
var ggbApp = new GGBApplet({"appName": "{$resource->geotype}", "width": 800, "height": 600, "showToolBar": true, "showAlgebraInput": true, "showMenuBar": true, "material_id":"{$resource->name)}" }, true);
window.addEventListener("load", function() {
ggbApp.inject('ggb-element');
});
</script>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo esto lo tenes que pasar a la seccion de arriba donde estan los scripts. (linea 5)
Vas a tener que agregar el if de @if ($resource->type == "Geogebra") ahi tambien para que se complete bien todos los datos.
En la parte de appName tenes que poner "{{$resource->geogebra_type}}" (lleva dobe llave, no una sola como tenes ahi) y en la de material_id, el otro campo que create con el codigo

<div class="form-group ggb-element">
<label for="geotype" class="col-md-2 control-label"><p>Seleccione tipo de elemento Geogebra</p></label>
<div class="col-md-6">
<select class="form-control" name="geotype" id= "geotype">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aca el name y id van a ser geogebra_type

@endforeach
</select>
</div>
</div>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tenes que agregar ademas un input para el otro campo que creaste geogebra_code. Es un input de tipo text

Comment on lines +58 to +64
<div class="form-group ggb-element">
<label for="ggb-element" class="col-md-2 control-label"><p>Geogebra</p></label>
<div class="col-md-6">
<input id="ggb-element" type="text" class="form-control" value="{{$resource->geogebra_id}}" name="ggb-element" autofocus>
</div>
</div>

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esto te tiene que quedar igual a lo que pusiste en el tempate de show, la diferencia es que tenes que agregar en el select, que se seleccione el geogebra_type que esta grabado en la base y en el geogebra_code, se complete el valor de la base tambien.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants